-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
41 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { ExceptionInterface } from '@concepta/ts-core'; | ||
|
||
export class OrgMemberException extends Error implements ExceptionInterface { | ||
errorCode = 'ORG_MEMBER_ERROR'; | ||
import { RuntimeException } from '@concepta/nestjs-exception'; | ||
|
||
export class OrgMemberException extends RuntimeException { | ||
constructor(message: string) { | ||
super(message); | ||
super({ | ||
message, | ||
}); | ||
this.errorCode = 'ORG_MEMBER_ERROR'; | ||
} | ||
} |
17 changes: 11 additions & 6 deletions
17
packages/nestjs-org/src/exceptions/org-not-found.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import { ExceptionInterface } from '@concepta/ts-core'; | ||
import { | ||
RuntimeException, | ||
RuntimeExceptionOptions, | ||
} from '@concepta/nestjs-exception'; | ||
|
||
export class OrgNotFoundException extends Error implements ExceptionInterface { | ||
errorCode = 'ORG_NOT_FOUND_ERROR'; | ||
|
||
constructor(message = 'The org was not found') { | ||
super(message); | ||
export class OrgNotFoundException extends RuntimeException { | ||
constructor(options?: RuntimeExceptionOptions) { | ||
super({ | ||
message: 'The org was not found', | ||
...options, | ||
}); | ||
this.errorCode = 'ORG_NOT_FOUND_ERROR'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
import { ExceptionInterface, mapNonErrorToException } from '@concepta/ts-core'; | ||
|
||
import { mapNonErrorToException } from '@concepta/ts-core'; | ||
import { RuntimeException } from '@concepta/nestjs-exception'; | ||
/** | ||
* Generic user exception. | ||
*/ | ||
export class UserException extends Error implements ExceptionInterface { | ||
errorCode = 'USER_ERROR'; | ||
|
||
context: { | ||
message: string; | ||
originalError: Error; | ||
}; | ||
|
||
export class UserException extends RuntimeException { | ||
constructor(message: string, originalError?: unknown) { | ||
super(message); | ||
this.context = { | ||
super({ | ||
message, | ||
originalError: mapNonErrorToException(originalError), | ||
}; | ||
}); | ||
this.errorCode = 'USER_ERROR'; | ||
} | ||
} |
19 changes: 13 additions & 6 deletions
19
packages/nestjs-user/src/exceptions/user-not-found-exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import { ExceptionInterface } from '@concepta/ts-core'; | ||
import { | ||
RuntimeException, | ||
RuntimeExceptionOptions, | ||
} from '@concepta/nestjs-exception'; | ||
import { HttpStatus } from '@nestjs/common'; | ||
|
||
export class UserNotFoundException extends Error implements ExceptionInterface { | ||
errorCode = 'USER_NOT_FOUND_ERROR'; | ||
|
||
constructor(message = 'The user was not found') { | ||
super(message); | ||
export class UserNotFoundException extends RuntimeException { | ||
constructor(options?: RuntimeExceptionOptions) { | ||
super({ | ||
message: 'The user was not found', | ||
httpStatus: HttpStatus.NOT_FOUND, | ||
...options, | ||
}); | ||
this.errorCode = 'USER_NOT_FOUND_ERROR'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters