mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 18:55:19 -04:00

The ErrorExceptionMapping class maps internal error to nestjs's appropriate HttpException. The object returned by those HttpExceptions is now changed to include the name of the intern error code and error message instead of statusCode and error message as is default. This makes it possible to more easily programmatically distinguish between two errors that map to the same HttpException and only differ in the error message. The statusCode was unnecessary, because any user of the api gets this information already by which HttpException was used. Signed-off-by: Philip Molares <philip.molares@udo.edu>
20 lines
363 B
TypeScript
20 lines
363 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
export interface HttpExceptionObject {
|
|
name: string;
|
|
message: string;
|
|
}
|
|
|
|
export function buildHttpExceptionObject(
|
|
name: string,
|
|
message: string,
|
|
): HttpExceptionObject {
|
|
return {
|
|
name: name,
|
|
message: message,
|
|
};
|
|
}
|