diff options
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/components/NewPaste.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/frontend/src/components/NewPaste.js b/frontend/src/components/NewPaste.js index 29ae9ca..2ce2ecf 100644 --- a/frontend/src/components/NewPaste.js +++ b/frontend/src/components/NewPaste.js @@ -111,8 +111,17 @@ class NewPaste extends React.Component { }).then((response) => { // on success, redir this.setState({ hash: response.data.hash }) - }).catch((response) => { - this.newErr(response) + }).catch((error) => { + const resp = error.response + + // some weird err + if (resp !== undefined) { + const errTxt = `${resp.statusText}: ${resp.data}` + this.newErr(errTxt) + } else { + // some weird err (e.g. network) + this.newErr(error) + } }); event.preventDefault(); |