Skip to content

Commit

Permalink
Added more accurate error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanCerenov committed Sep 24, 2023
1 parent f3c7ca7 commit 6bd1a8f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
21 changes: 21 additions & 0 deletions packages/api-v2/src/plan/plan.errors.ts
Original file line number Diff line number Diff line change
@@ -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();
}
}
6 changes: 5 additions & 1 deletion packages/api-v2/src/plan/plan.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -179,7 +180,7 @@ export class PlanService {
},
this.formatPlanServiceCtx("update")
);

throw new InvalidMajor();
return null;
}

Expand All @@ -201,8 +202,11 @@ export class PlanService {
this.formatPlanServiceCtx("update")
);

throw new InvalidConcentration();
return null;
}


}

/**
Expand Down

0 comments on commit 6bd1a8f

Please sign in to comment.