Added custom errors

ref #4 #5
This commit is contained in:
2020-11-27 21:35:28 +01:00
parent aef2f9562a
commit 01542ae6a8
2 changed files with 25 additions and 8 deletions

18
src/errors/TrackErrors.ts Normal file
View File

@@ -0,0 +1,18 @@
import { JsonController, Param, Body, Get, Post, Put, Delete, NotFoundError, OnUndefined, NotAcceptableError } from 'routing-controllers';
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
export class TrackNotFoundError extends NotFoundError {
@IsString()
name = "TrackNotFoundError"
@IsString()
message = "Track not found!"
}
export class TrackIdChangeNotAllowedError extends NotAcceptableError {
@IsString()
name = "TrackIdChangeNotAllowed"
@IsString()
message = "The id's don't match!!"
}