aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/undici/lib/interceptor/response-error.js
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
commitafa87af01c79a9baa539f2992d32154d2a4739bd (patch)
tree92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/undici/lib/interceptor/response-error.js
parent3b927e84d200402281f68181cd4253bc77e5528d (diff)
downloadneko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/undici/lib/interceptor/response-error.js')
-rw-r--r--vanilla/node_modules/undici/lib/interceptor/response-error.js95
1 files changed, 0 insertions, 95 deletions
diff --git a/vanilla/node_modules/undici/lib/interceptor/response-error.js b/vanilla/node_modules/undici/lib/interceptor/response-error.js
deleted file mode 100644
index a8105aa..0000000
--- a/vanilla/node_modules/undici/lib/interceptor/response-error.js
+++ /dev/null
@@ -1,95 +0,0 @@
-'use strict'
-
-// const { parseHeaders } = require('../core/util')
-const DecoratorHandler = require('../handler/decorator-handler')
-const { ResponseError } = require('../core/errors')
-
-class ResponseErrorHandler extends DecoratorHandler {
- #statusCode
- #contentType
- #decoder
- #headers
- #body
-
- constructor (_opts, { handler }) {
- super(handler)
- }
-
- #checkContentType (contentType) {
- return (this.#contentType ?? '').indexOf(contentType) === 0
- }
-
- onRequestStart (controller, context) {
- this.#statusCode = 0
- this.#contentType = null
- this.#decoder = null
- this.#headers = null
- this.#body = ''
-
- return super.onRequestStart(controller, context)
- }
-
- onResponseStart (controller, statusCode, headers, statusMessage) {
- this.#statusCode = statusCode
- this.#headers = headers
- this.#contentType = headers['content-type']
-
- if (this.#statusCode < 400) {
- return super.onResponseStart(controller, statusCode, headers, statusMessage)
- }
-
- if (this.#checkContentType('application/json') || this.#checkContentType('text/plain')) {
- this.#decoder = new TextDecoder('utf-8')
- }
- }
-
- onResponseData (controller, chunk) {
- if (this.#statusCode < 400) {
- return super.onResponseData(controller, chunk)
- }
-
- this.#body += this.#decoder?.decode(chunk, { stream: true }) ?? ''
- }
-
- onResponseEnd (controller, trailers) {
- if (this.#statusCode >= 400) {
- this.#body += this.#decoder?.decode(undefined, { stream: false }) ?? ''
-
- if (this.#checkContentType('application/json')) {
- try {
- this.#body = JSON.parse(this.#body)
- } catch {
- // Do nothing...
- }
- }
-
- let err
- const stackTraceLimit = Error.stackTraceLimit
- Error.stackTraceLimit = 0
- try {
- err = new ResponseError('Response Error', this.#statusCode, {
- body: this.#body,
- headers: this.#headers
- })
- } finally {
- Error.stackTraceLimit = stackTraceLimit
- }
-
- super.onResponseError(controller, err)
- } else {
- super.onResponseEnd(controller, trailers)
- }
- }
-
- onResponseError (controller, err) {
- super.onResponseError(controller, err)
- }
-}
-
-module.exports = () => {
- return (dispatch) => {
- return function Intercept (opts, handler) {
- return dispatch(opts, new ResponseErrorHandler(opts, { handler }))
- }
- }
-}