This repository has been archived on 2026-07-15. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drive/frontend/node_modules/tus-js-client/lib/error.js
Elijah 724d70e58b
Some checks failed
Automated Container Build / build-and-push (push) Failing after 12s
Inital build
2026-05-22 12:29:43 -07:00

25 lines
797 B
JavaScript

class DetailedError extends Error {
constructor(message, causingErr = null, req = null, res = null) {
super(message)
this.originalRequest = req
this.originalResponse = res
this.causingError = causingErr
if (causingErr != null) {
message += `, caused by ${causingErr.toString()}`
}
if (req != null) {
const requestId = req.getHeader('X-Request-ID') || 'n/a'
const method = req.getMethod()
const url = req.getURL()
const status = res ? res.getStatus() : 'n/a'
const body = res ? res.getBody() || '' : 'n/a'
message += `, originated from request (method: ${method}, url: ${url}, response code: ${status}, response text: ${body}, request id: ${requestId})`
}
this.message = message
}
}
export default DetailedError