Skip to content

Commit

Permalink
Add a handler for AxiosError errors (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-f1 authored Apr 17, 2023
1 parent 104c980 commit 652d75a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/app-nordigen/app-nordigen.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/189.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [j-f1]
---

More clearly report the problem with Nordigen requests that fail with an unexpected status code

0 comments on commit 652d75a

Please sign in to comment.