(message, error)
| 23 | : ''; |
| 24 | |
| 25 | const errorNotification = (message, error) => { |
| 26 | let errorMessage = ''; |
| 27 | |
| 28 | if (error.status) { |
| 29 | try { |
| 30 | // Try to format the error body if it's an object |
| 31 | if (typeof error.body === 'object') { |
| 32 | errorMessage = JSON.stringify(error.body, null, 2); |
| 33 | } else { |
| 34 | errorMessage = `${error.status} - ${error.body}`; |
| 35 | } |
| 36 | } catch (e) { |
| 37 | errorMessage = `${error.status} - ${String(error.body)}`; |
| 38 | } |
| 39 | } else { |
| 40 | errorMessage = error.message || 'Unknown error'; |
| 41 | } |
| 42 | |
| 43 | notifications.show({ |
| 44 | title: 'Error', |
| 45 | message: `${message}: ${errorMessage}`, |
| 46 | autoClose: 10000, |
| 47 | color: 'red', |
| 48 | }); |
| 49 | |
| 50 | throw error; |
| 51 | }; |
| 52 | |
| 53 | const request = async (url, options = {}) => { |
| 54 | if ( |
no outgoing calls
no test coverage detected