mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 17:23:21 +03:00
feat(server): better api error messages (for unhandled exceptions) (#4817)
* feat(server): better error messages * chore: open api * chore: remove debug log * fix: syntax error * fix: e2e test
This commit is contained in:
@@ -47,6 +47,9 @@ function sortKeys<T>(obj: T): T {
|
||||
return result as T;
|
||||
}
|
||||
|
||||
export const routeToErrorMessage = (methodName: string) =>
|
||||
'Failed to ' + methodName.replace(/[A-Z]+/g, (letter) => ` ${letter.toLowerCase()}`);
|
||||
|
||||
const patchOpenAPI = (document: OpenAPIObject) => {
|
||||
document.paths = sortKeys(document.paths);
|
||||
if (document.components?.schemas) {
|
||||
@@ -78,6 +81,10 @@ const patchOpenAPI = (document: OpenAPIObject) => {
|
||||
delete operation.summary;
|
||||
}
|
||||
|
||||
if (operation.operationId) {
|
||||
// console.log(`${routeToErrorMessage(operation.operationId).padEnd(40)} (${operation.operationId})`);
|
||||
}
|
||||
|
||||
if (operation.description === '') {
|
||||
delete operation.description;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user