aboutsummaryrefslogtreecommitdiff
path: root/src/services/errors/errors.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-02-28 17:19:14 +0000
committerShpuld Shpludson <shp@cock.li>2019-02-28 17:19:14 +0000
commitdc01f90dde55e2babf58878177308c11aa965006 (patch)
tree1bf886d2f80300d672acd4e47f6dfd213113c163 /src/services/errors/errors.js
parent24f3770fb5ca47b41a9fbf8711dd614fb50537ca (diff)
parentb78227456ea6b1a80cd85988d3ef91cb654a881c (diff)
Merge branch '386-display-invalid-user-profile' into 'develop'
Show error message when visit profile page of invalid user Closes #386 See merge request pleroma/pleroma-fe!606
Diffstat (limited to 'src/services/errors/errors.js')
-rw-r--r--src/services/errors/errors.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/services/errors/errors.js b/src/services/errors/errors.js
new file mode 100644
index 00000000..548f3c68
--- /dev/null
+++ b/src/services/errors/errors.js
@@ -0,0 +1,14 @@
+export function StatusCodeError (statusCode, body, options, response) {
+ this.name = 'StatusCodeError'
+ this.statusCode = statusCode
+ this.message = statusCode + ' - ' + (JSON && JSON.stringify ? JSON.stringify(body) : body)
+ this.error = body // legacy attribute
+ this.options = options
+ this.response = response
+
+ if (Error.captureStackTrace) { // required for non-V8 environments
+ Error.captureStackTrace(this)
+ }
+}
+StatusCodeError.prototype = Object.create(Error.prototype)
+StatusCodeError.prototype.constructor = StatusCodeError