24
src/errors/PrincipalErrors.ts
Normal file
24
src/errors/PrincipalErrors.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { IsString } from 'class-validator';
|
||||
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
|
||||
|
||||
/**
|
||||
* Error to throw when a user couldn't be found.
|
||||
*/
|
||||
export class PrincipalNotFoundError extends NotFoundError {
|
||||
@IsString()
|
||||
name = "PrincipalNotFoundError"
|
||||
|
||||
@IsString()
|
||||
message = "Principal not found!"
|
||||
}
|
||||
|
||||
/**
|
||||
* Error to throw, when a provided runnerOrganisation doesn't belong to the accepted types.
|
||||
*/
|
||||
export class PrincipalWrongTypeError extends NotAcceptableError {
|
||||
@IsString()
|
||||
name = "PrincipalWrongTypeError"
|
||||
|
||||
@IsString()
|
||||
message = "The princial must have an existing principal's id. \n You provided a object of another type."
|
||||
}
|
||||
Reference in New Issue
Block a user