diff --git a/src/app-nordigen/app-nordigen.js b/src/app-nordigen/app-nordigen.js index 7d06fe48e..670f24c2e 100644 --- a/src/app-nordigen/app-nordigen.js +++ b/src/app-nordigen/app-nordigen.js @@ -1,5 +1,7 @@ +import { isAxiosError } from 'axios'; import express from 'express'; import path from 'path'; +import { inspect } from 'util'; import { nordigenService } from './services/nordigen-service.js'; import { @@ -193,14 +195,24 @@ app.post( }); break; case error instanceof GenericNordigenError: - console.log({ message: 'Something went wrong', error }); + console.log('Something went wrong', inspect(error, { depth: null })); + sendErrorResponse({ + error_type: 'SYNC_ERROR', + error_code: 'NORDIGEN_ERROR', + }); + break; + case isAxiosError(error): + console.log( + 'Something went wrong', + inspect(error.response.data, { depth: null }), + ); sendErrorResponse({ error_type: 'SYNC_ERROR', error_code: 'NORDIGEN_ERROR', }); break; default: - console.log({ message: 'Something went wrong', error }); + console.log('Something went wrong', inspect(error, { depth: null })); sendErrorResponse({ error_type: 'UNKNOWN', error_code: 'UNKNOWN', diff --git a/upcoming-release-notes/189.md b/upcoming-release-notes/189.md new file mode 100644 index 000000000..dcbc7b0b3 --- /dev/null +++ b/upcoming-release-notes/189.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [j-f1] +--- + +More clearly report the problem with Nordigen requests that fail with an unexpected status code