| Total Complexity | 3 |
| Complexity/F | 3 |
| Lines of Code | 17 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { _ } from 'svelte-i18n'; |
||
| 2 | |||
| 3 | export const errorNormalizer = (e) => { |
||
| 4 | if (!e.response) { |
||
| 5 | // eslint-disable-next-line no-console |
||
| 6 | console.error('Non standard error', e); |
||
| 7 | return [_('error_generic')]; |
||
| 8 | } |
||
| 9 | |||
| 10 | const { message } = e.response.data; |
||
| 11 | |||
| 12 | if (Array.isArray(message)) { |
||
| 13 | return message; |
||
| 14 | } |
||
| 15 | |||
| 16 | return [message]; |
||
| 17 | }; |
||
| 18 |