aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorjackyzha0 <[email protected]>2020-05-11 21:43:15 -0700
committerjackyzha0 <[email protected]>2020-05-11 21:43:15 -0700
commit021b8cd46b1fa70a8da2fc867412bb65afd42722 (patch)
tree398966c0aa9bdfadb4285b62e0ce1aede213d396 /frontend
parenterror print (diff)
downloadctrl-v-021b8cd46b1fa70a8da2fc867412bb65afd42722.tar.xz
ctrl-v-021b8cd46b1fa70a8da2fc867412bb65afd42722.zip
add err messages
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/components/NewPaste.js13
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();