UserForm: ajout retour de validation d'API
This commit is contained in:
21
frontend/src/errors/api.error.js
Normal file
21
frontend/src/errors/api.error.js
Normal file
@ -0,0 +1,21 @@
|
||||
export class APIError extends Error {
|
||||
constructor(endpoint, code, message, data) {
|
||||
super(`APIError: ${message}`);
|
||||
this.endpoint = endpoint;
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
Error.captureStackTrace(this, APIError);
|
||||
}
|
||||
|
||||
getEndpoint() {
|
||||
return this.endpoint;
|
||||
}
|
||||
|
||||
getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
getData() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user