diff --git a/packages/api-v2/src/plan/plan.errors.ts b/packages/api-v2/src/plan/plan.errors.ts new file mode 100644 index 000000000..626c4c3f9 --- /dev/null +++ b/packages/api-v2/src/plan/plan.errors.ts @@ -0,0 +1,21 @@ +// InvalidMajor +// InvalidCatalogYear +// InvalidConcentration + +export class InvalidMajor extends Error { + constructor() { + super(); + } +} + +export class InvalidCatalogYear extends Error { + constructor() { + super(); + } +} + +export class InvalidConcentration extends Error { + constructor() { + super(); + } +} diff --git a/packages/api-v2/src/plan/plan.service.ts b/packages/api-v2/src/plan/plan.service.ts index 12322e8ba..e6b3c88ac 100644 --- a/packages/api-v2/src/plan/plan.service.ts +++ b/packages/api-v2/src/plan/plan.service.ts @@ -7,6 +7,7 @@ import { CreatePlanDto, UpdatePlanDto } from "@graduate/common"; import { Plan } from "./entities/plan.entity"; import { formatServiceCtx } from "../../src/utils"; import { MajorService } from "../major/major.service"; +import { InvalidConcentration, InvalidMajor } from "./plan.errors"; @Injectable() export class PlanService { @@ -179,7 +180,7 @@ export class PlanService { }, this.formatPlanServiceCtx("update") ); - + throw new InvalidMajor(); return null; } @@ -201,8 +202,11 @@ export class PlanService { this.formatPlanServiceCtx("update") ); + throw new InvalidConcentration(); return null; } + + } /**