@jitsu/functions-lib
Advanced tools
Comparing version
@@ -6,10 +6,51 @@ 'use strict'; | ||
class RetryError extends Error { | ||
status; | ||
response; | ||
message; | ||
constructor(message, options) { | ||
super(message); | ||
if (typeof message === "object") { | ||
super(message.message); | ||
this.message = message.message; | ||
this.status = message.status; | ||
this.response = message.response; | ||
} | ||
else { | ||
super(message); | ||
this.message = message; | ||
} | ||
this.name = options?.drop ? `${DropRetryErrorName}` : `${RetryErrorName}`; | ||
} | ||
toJSON() { | ||
return { | ||
name: this.name, | ||
message: this.message, | ||
status: this.status, | ||
response: this.response, | ||
}; | ||
} | ||
} | ||
class HTTPError extends Error { | ||
status; | ||
response; | ||
message; | ||
constructor(message, status, response) { | ||
super(message); | ||
this.message = message; | ||
this.name = "HTTPError"; | ||
this.status = status; | ||
this.response = response.length > 1000 ? response.slice(0, 1000) + "..." : response; | ||
} | ||
toJSON() { | ||
return { | ||
name: this.name, | ||
message: this.message, | ||
status: this.status, | ||
response: this.response, | ||
}; | ||
} | ||
} | ||
exports.DropRetryErrorName = DropRetryErrorName; | ||
exports.HTTPError = HTTPError; | ||
exports.RetryError = RetryError; | ||
exports.RetryErrorName = RetryErrorName; |
const DropRetryErrorName = "Drop & RetryError"; | ||
const RetryErrorName = "RetryError"; | ||
class RetryError extends Error { | ||
status; | ||
response; | ||
message; | ||
constructor(message, options) { | ||
super(message); | ||
if (typeof message === "object") { | ||
super(message.message); | ||
this.message = message.message; | ||
this.status = message.status; | ||
this.response = message.response; | ||
} | ||
else { | ||
super(message); | ||
this.message = message; | ||
} | ||
this.name = options?.drop ? `${DropRetryErrorName}` : `${RetryErrorName}`; | ||
} | ||
toJSON() { | ||
return { | ||
name: this.name, | ||
message: this.message, | ||
status: this.status, | ||
response: this.response, | ||
}; | ||
} | ||
} | ||
class HTTPError extends Error { | ||
status; | ||
response; | ||
message; | ||
constructor(message, status, response) { | ||
super(message); | ||
this.message = message; | ||
this.name = "HTTPError"; | ||
this.status = status; | ||
this.response = response.length > 1000 ? response.slice(0, 1000) + "..." : response; | ||
} | ||
toJSON() { | ||
return { | ||
name: this.name, | ||
message: this.message, | ||
status: this.status, | ||
response: this.response, | ||
}; | ||
} | ||
} | ||
export { DropRetryErrorName, RetryError, RetryErrorName }; | ||
export { DropRetryErrorName, HTTPError, RetryError, RetryErrorName }; |
export declare const DropRetryErrorName = "Drop & RetryError"; | ||
export declare const RetryErrorName = "RetryError"; | ||
export declare class RetryError extends Error { | ||
status: number; | ||
response: string; | ||
message: string; | ||
constructor(message?: any, options?: { | ||
drop: boolean; | ||
}); | ||
toJSON(): { | ||
name: string; | ||
message: string; | ||
status: number; | ||
response: string; | ||
}; | ||
} | ||
export declare class HTTPError extends Error { | ||
status: number; | ||
response: string; | ||
message: string; | ||
constructor(message: string, status: number, response: string); | ||
toJSON(): { | ||
name: string; | ||
message: string; | ||
status: number; | ||
response: string; | ||
}; | ||
} |
{ | ||
"name": "@jitsu/functions-lib", | ||
"version": "1.7.1", | ||
"version": "1.9.0-canary.548.20240108170646", | ||
"main": "dist/index.cjs.js", | ||
@@ -28,4 +28,4 @@ "module": "dist/index.es.js", | ||
"compile": "tsc -p .", | ||
"build": "rollup -c" | ||
"build": "pnpm compile && rollup -c" | ||
} | ||
} |
@@ -5,6 +5,47 @@ export const DropRetryErrorName = "Drop & RetryError"; | ||
export class RetryError extends Error { | ||
status: number; | ||
response: string; | ||
message: string; | ||
constructor(message?: any, options?: { drop: boolean }) { | ||
super(message); | ||
if (typeof message === "object") { | ||
super(message.message); | ||
this.message = message.message; | ||
this.status = message.status; | ||
this.response = message.response; | ||
} else { | ||
super(message); | ||
this.message = message; | ||
} | ||
this.name = options?.drop ? `${DropRetryErrorName}` : `${RetryErrorName}`; | ||
} | ||
toJSON() { | ||
return { | ||
name: this.name, | ||
message: this.message, | ||
status: this.status, | ||
response: this.response, | ||
}; | ||
} | ||
} | ||
export class HTTPError extends Error { | ||
status: number; | ||
response: string; | ||
message: string; | ||
constructor(message: string, status: number, response: string) { | ||
super(message); | ||
this.message = message; | ||
this.name = "HTTPError"; | ||
this.status = status; | ||
this.response = response.length > 1000 ? response.slice(0, 1000) + "..." : response; | ||
} | ||
toJSON() { | ||
return { | ||
name: this.name, | ||
message: this.message, | ||
status: this.status, | ||
response: this.response, | ||
}; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8120
88.44%209
207.35%2
100%1
Infinity%