1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-05-13 04:41:43 +00:00

Resolve "Show a notification of a 500 error in the frontend"

This commit is contained in:
Przemyslaw Kukulski 2024-07-08 12:01:35 +00:00
parent d1ecf71f25
commit 385618900e
3 changed files with 20 additions and 0 deletions
changelog/entries/unreleased/bug
web-frontend
modules/core/plugins
test/unit/core/utils

View file

@ -0,0 +1,7 @@
{
"type": "bug",
"message": "Show a notification of a 500 error in the frontend",
"issue_number": 2754,
"bullet_points": [],
"created_at": "2024-07-05"
}

View file

@ -479,6 +479,8 @@ export function makeErrorResponseInterceptor(
'detail' in rspData
) {
error.handler.setError(rspData.error, rspData.detail)
} else if (typeof rspData !== 'object') {
error.handler.setError(500, null)
}
return Promise.reject(error)

View file

@ -341,6 +341,17 @@ describe('test error handling', () => {
}
}
)
test('test an 500 response returns action not completed error', async () => {
try {
await errorInterceptorWithStubAppAndStore()({
response: 'traceback from backend',
})
} catch (error) {
expect(error.response).toBe('traceback from backend')
expect(error.handler.code).toBe(500)
expect(error.handler.detail).toBe(null)
}
})
describe('test invalid response details for request body validation errors', () => {
const invalidDetails = [
null,