aboutsummaryrefslogtreecommitdiff
path: root/src/services/errors/errors.js
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-01-14 22:08:24 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-01-14 22:08:24 +0300
commitf892b26d73ea54c4557d8b6829dba850f00986c6 (patch)
treeeb7233b9d6dcef55ec79fd80c19cb9443f109499 /src/services/errors/errors.js
parent40c4a49223daaa95ee6e1597e84ced9bd5401865 (diff)
parent7397636914a9d3e7fd30373034c25175273ab808 (diff)
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma-fe into develop
Diffstat (limited to 'src/services/errors/errors.js')
-rw-r--r--src/services/errors/errors.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/services/errors/errors.js b/src/services/errors/errors.js
index 590552da..d4cf9132 100644
--- a/src/services/errors/errors.js
+++ b/src/services/errors/errors.js
@@ -32,12 +32,18 @@ export class RegistrationError extends Error {
}
if (typeof error === 'object') {
+ const errorContents = JSON.parse(error.error)
+ // keys will have the property that has the error, for example 'ap_id',
+ // 'email' or 'captcha', the value will be an array of its error
+ // like "ap_id": ["has been taken"] or "captcha": ["Invalid CAPTCHA"]
+
// replace ap_id with username
- if (error.ap_id) {
- error.username = error.ap_id
- delete error.ap_id
+ if (errorContents.ap_id) {
+ errorContents.username = errorContents.ap_id
+ delete errorContents.ap_id
}
- this.message = humanizeErrors(error)
+
+ this.message = humanizeErrors(errorContents)
} else {
this.message = error
}