feat: 🎸 merge in plan editor
This commit is contained in:
29
shared/api/errors/classes/featureErrClasses.ts
Normal file
29
shared/api/errors/classes/featureErrClasses.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { RecaseError } from "../base/RecaseError.js";
|
||||
import { FeatureErrorCode } from "../codes/featureErrCodes.js";
|
||||
|
||||
/**
|
||||
* Product not found error
|
||||
*/
|
||||
export class FeatureAlreadyExistsError extends RecaseError {
|
||||
constructor(opts: { productId: string; version?: string }) {
|
||||
super({
|
||||
message: `Product ${opts.productId} ${opts.version ? ` (version ${opts.version})` : ""} not found`,
|
||||
code: FeatureErrorCode.FeatureAlreadyExists,
|
||||
statusCode: 404,
|
||||
});
|
||||
this.name = "ProductNotFoundError";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Feature not found error
|
||||
*/
|
||||
export class FeatureNotFoundError extends RecaseError {
|
||||
constructor(opts: { featureId: string }) {
|
||||
super({
|
||||
message: `Feature ${opts.featureId} not found`,
|
||||
code: FeatureErrorCode.FeatureNotFound,
|
||||
statusCode: 404,
|
||||
});
|
||||
}
|
||||
}
|
||||
7
shared/api/errors/codes/featureErrCodes.ts
Normal file
7
shared/api/errors/codes/featureErrCodes.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const FeatureErrorCode = {
|
||||
FeatureNotFound: "feature_not_found",
|
||||
FeatureAlreadyExists: "feature_already_exists",
|
||||
} as const;
|
||||
|
||||
export type FeatureErrorCode =
|
||||
(typeof FeatureErrorCode)[keyof typeof FeatureErrorCode];
|
||||
Reference in New Issue
Block a user