mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	refactor(errors): extend errors from Error and add/assign statusCode
this is in preparation for updating the routes/handleException method, to get rid of "any" (and improve in general)
This commit is contained in:
		| @@ -1,8 +1,9 @@ | ||||
| class NotFoundError { | ||||
|     message: string; | ||||
|  | ||||
| class NotFoundError extends Error { | ||||
|     statusCode: number; | ||||
|     constructor(message: string) { | ||||
|         this.message = message; | ||||
|         super(message); | ||||
|         this.name = "NotFoundError"; | ||||
|         this.statusCode = 404; | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,11 @@ | ||||
| class ValidationError { | ||||
|     message: string; | ||||
|  | ||||
| class ValidationError extends Error { | ||||
|     statusCode: number; | ||||
|     constructor(message: string) { | ||||
|         this.message = message; | ||||
|         super(message) | ||||
|         this.name = "ValidationError"; | ||||
|         this.statusCode = 400; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| export default ValidationError; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user