Skip to content

Commit

Permalink
Merge pull request #969 from stakwork/hotfix/955
Browse files Browse the repository at this point in the history
feat: fix error condition
  • Loading branch information
Rassl authored Feb 26, 2024
2 parents cc0ece9 + 15bee13 commit 2014a3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/AddItemModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ const handleSubmitForm = async (
} catch (err: any) {
let errorMessage = NODE_ADD_ERROR

if (err?.response && err.response.data && err.response.data.message) {
errorMessage = err.response.data.message
if (err.status === 400) {
const error = await err.json()

errorMessage = error.errorCode || error?.status || NODE_ADD_ERROR
} else if (err instanceof Error) {
errorMessage = err.message
}
Expand Down

0 comments on commit 2014a3b

Please sign in to comment.