aboutsummaryrefslogtreecommitdiff
path: root/src/services/errors/errors.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-03-07 15:11:11 +0000
committerShpuld Shpludson <shp@cock.li>2019-03-07 15:11:11 +0000
commit7e9c8c3d219aa3b787c5606efbb54a73c1738b07 (patch)
tree1847fa78707d800e28997bd8828327cf5c890838 /src/services/errors/errors.js
parent4800169f36e0a71c322b9707a797c3b1ad48bf58 (diff)
parentc44f0a9bde08c50598207494b121ae4bdf1f0fb1 (diff)
Merge branch 'develop' into 'master'
Update master See merge request pleroma/pleroma-fe!646
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