Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bun nx run-many --target=lint,test:unit
pnpm nx run-many --target=lint,test:unit
11 changes: 11 additions & 0 deletions packages/common/src/exception/abstracts/exception.abstract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { INfException } from "../interfaces/exception.type";

export abstract class NfException extends Error implements INfException {
abstract get code(): number;

protected constructor(message?: string) {
super(
message ? `[NANOFORGE] ${message}` : "[NANOFORGE] An error occurred (Unknown exception).",
);
}
}
11 changes: 11 additions & 0 deletions packages/common/src/exception/exceptions/not-found.exception.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NfException } from "../abstracts/exception.abstract";

export class NfNotFound extends NfException {
get code(): number {
return 404;
}

constructor(item: string, type?: string) {
super(`${type ? `${type} - ` : ""}${item} not found.`);
}
}
1 change: 1 addition & 0 deletions packages/common/src/exception/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { NfNotFound } from "./exceptions/not-found.exception";
1 change: 0 additions & 1 deletion packages/common/src/exceptions/index.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/common/src/exceptions/notFound.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from "./context";
export * from "./library";
export * from "./options";
export * from "./exceptions";
export * from "./exception";
Loading