36 lines
996 B
TypeScript
36 lines
996 B
TypeScript
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 permissions' 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 ids don't match! \n And if you wanted to change a permission's id: This isn't allowed!"
|
|
}
|
|
|
|
/**
|
|
* Error to throw when a permission gets provided without a principal.
|
|
*/
|
|
export class PermissionNeedsPrincipalError extends NotAcceptableError {
|
|
@IsString()
|
|
name = "PermissionNeedsPrincipalError"
|
|
|
|
@IsString()
|
|
message = "You provided no principal for this permission."
|
|
} |