access: Fix error handling in JS

This commit is contained in:
2025-05-03 11:53:19 +02:00
parent 7cf3e21efc
commit 4962218fe3
2 changed files with 14 additions and 3 deletions

View File

@ -8,6 +8,7 @@ const ERROR_MESSAGES = {
class ApiError extends Error {
constructor(statusCode, message) {
super(statusCode + ' - ' + message);
this.statusCode = statusCode;
this.name = 'ApiError';
this.localizedMessage = ERROR_MESSAGES[statusCode];
}