25
src/errors/PermissionErrors.ts
Normal file
25
src/errors/PermissionErrors.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { IsString } from 'class-validator';
|
||||
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
|
||||
|
||||
/**
|
||||
* Error to throw when a permission couldn't be found.
|
||||
*/
|
||||
export class PermissionNotFoundError extends NotFoundError {
|
||||
@IsString()
|
||||
name = "PermissionNotFoundError"
|
||||
|
||||
@IsString()
|
||||
message = "Permission not found!"
|
||||
}
|
||||
|
||||
/**
|
||||
* Error to throw when two permission' ids don't match.
|
||||
* Usually occurs when a user tries to change a permission's id.
|
||||
*/
|
||||
export class PermissionIdsNotMatchingError extends NotAcceptableError {
|
||||
@IsString()
|
||||
name = "PermissionIdsNotMatchingError"
|
||||
|
||||
@IsString()
|
||||
message = "The id's don't match!! \n And if you wanted to change a permission's id: This isn't allowed"
|
||||
}
|
||||
13
src/errors/PrincipalsErrors.ts
Normal file
13
src/errors/PrincipalsErrors.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { IsString } from 'class-validator';
|
||||
import { 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!"
|
||||
}
|
||||
Reference in New Issue
Block a user