diff options
| author | jackyzha0 <[email protected]> | 2020-05-11 21:43:15 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-05-11 21:43:15 -0700 |
| commit | 021b8cd46b1fa70a8da2fc867412bb65afd42722 (patch) | |
| tree | 398966c0aa9bdfadb4285b62e0ce1aede213d396 /frontend/src | |
| parent | error print (diff) | |
| download | ctrl-v-021b8cd46b1fa70a8da2fc867412bb65afd42722.tar.xz ctrl-v-021b8cd46b1fa70a8da2fc867412bb65afd42722.zip | |
add err messages
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(); |