1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-13 11:17:26 +02:00
unleash.unleash/src/lib/error/incompatible-project-error.ts
Christopher Kolstad b7b5f0caa0
fix: add constraint for changing project. (#1049)
- In order for a feature toggle to be allowed to change project, the
  target project must have the same enabled environments.
- If the feature toggle has an environment which is not in use that does
  not exist in target project, this is ok.

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2021-10-21 10:29:09 +02:00

24 lines
605 B
TypeScript

export default class IncompatibleProjectError extends Error {
constructor(targetProject: string) {
super();
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = `${targetProject} is not a compatible target`;
}
toJSON(): any {
const obj = {
isJoi: true,
name: this.constructor.name,
details: [
{
validationErrors: [],
message: this.message,
},
],
};
return obj;
}
}