Skip to content

Commit

Permalink
Improve error messages during project creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-shawley committed Apr 18, 2024
1 parent 165e9ae commit 99c811f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export async function httpRequest(fetchMethod, path, options = requestOptions) {
success: false,
data: getErrorMessage(response, data),
status: response.status,
headers: response.headers
headers: response.headers,
responseBody: data
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/js/views/Project/Create/Create.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,15 @@ function Create() {
if (response.success) {
navigate(`/ui/projects/${response.data.id}`)
} else {
setErrorMessage(response.data)
let errorMessage = response.data
if (response.responseBody?.title) {
if (response.responseBody?.detail) {
errorMessage = `${response.responseBody.title} - ${response.responseBody.detail}`
} else {
errorMessage = response.responseBody.title
}
}
setErrorMessage(errorMessage)
}
}

Expand Down

0 comments on commit 99c811f

Please sign in to comment.