mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 21:24:11 +00:00
Improve error handling in server (#812)
* add functions to convert all errors to `ErrorResponse` type
* replace all `{ message: error.toString() }` with `toErrorResponse(error)`
* refactor: all controllers to to use getErrorMessage and add types to the Response
* 404 for nonexistent api routes
This commit is contained in:
committed by
GitHub
parent
d432f1e3ff
commit
8a1474e8d6
@@ -55,7 +55,7 @@ export { deepmerge } from './src/externals/deepmerge.js';
|
||||
export { deleteAtIndex, insertAtIndex, reorderArray, sortArrayByProperty } from './src/array-utils/arrayUtils.js';
|
||||
|
||||
// generic utilities
|
||||
export { unpackError } from './src/generic/generic.js';
|
||||
export { getErrorMessage } from './src/generic/generic.js';
|
||||
export { obfuscate, unobfuscate } from './src/generic/generic.js';
|
||||
export { isNumeric } from './src/types/types.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export function unpackError(error: unknown): string {
|
||||
export function getErrorMessage(error: unknown): string {
|
||||
if (error instanceof Error) {
|
||||
return error.message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user