parent
ce2c38e188
commit
a0e6424d48
@ -1,24 +0,0 @@
|
|||||||
import { NotFoundError } from 'routing-controllers';
|
|
||||||
import { IsString } from 'class-validator';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error to throw when a usergroup couldn't be found.
|
|
||||||
*/
|
|
||||||
export class UserGroupNotFoundError extends NotFoundError {
|
|
||||||
@IsString()
|
|
||||||
name = "UserGroupNotFoundError"
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
message = "User Group not found!"
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error to throw when no username or email is set
|
|
||||||
*/
|
|
||||||
export class UsernameOrEmailNeededError extends NotFoundError {
|
|
||||||
@IsString()
|
|
||||||
name = "UsernameOrEmailNeededError"
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
message = "no username or email is set!"
|
|
||||||
}
|
|
47
src/errors/UserErrors.ts
Normal file
47
src/errors/UserErrors.ts
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import { IsString } from 'class-validator';
|
||||||
|
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error to throw when a usergroup couldn't be found.
|
||||||
|
*/
|
||||||
|
export class UserGroupNotFoundError extends NotFoundError {
|
||||||
|
@IsString()
|
||||||
|
name = "UserGroupNotFoundError"
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
message = "User Group not found!"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error to throw when no username or email is set
|
||||||
|
*/
|
||||||
|
export class UsernameOrEmailNeededError extends NotFoundError {
|
||||||
|
@IsString()
|
||||||
|
name = "UsernameOrEmailNeededError"
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
message = "no username or email is set!"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error to throw when a user couldn't be found.
|
||||||
|
*/
|
||||||
|
export class UserNotFoundError extends NotFoundError {
|
||||||
|
@IsString()
|
||||||
|
name = "UserNotFoundError"
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
message = "User not found!"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error to throw when two users' ids don't match.
|
||||||
|
* Usually occurs when a user tries to change a user's id.
|
||||||
|
*/
|
||||||
|
export class UserIdsNotMatchingError extends NotAcceptableError {
|
||||||
|
@IsString()
|
||||||
|
name = "UserIdsNotMatchingError"
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
message = "The id's don't match!! \n And if you wanted to change a user's id: This isn't allowed"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user