feat: Implement get app API endpoint

This commit is contained in:
Faruk AYDIN
2024-02-26 17:59:48 +01:00
parent f0e2d36c34
commit 7d5b2ec81e
6 changed files with 668 additions and 1 deletions

View File

@@ -9,12 +9,23 @@ const errorHandler = (error, request, response, next) => {
response.status(404).end();
}
if (notFoundAppError(error)) {
response.status(404).end();
}
if (error instanceof DataError) {
response.status(400).end();
}
logger.error(error.message + '\n' + error.stack);
response.status(error.statusCode || 500);
response.status(error.statusCode || 500).end();
};
const notFoundAppError = (error) => {
return (
error.message.includes('An application with the') ||
error.message.includes("key couldn't be found.")
);
};
export default errorHandler;