@appsignal/javascript
Advanced tools
Comparing version 1.3.30 to 1.3.31
# AppSignal for JavaScript changelog | ||
## 1.3.31 | ||
_Published on 2024-09-12._ | ||
### Added | ||
- Allow `ErrorEvent` instances to be reported to AppSignal. (patch [fb189a5](https://github.com/appsignal/appsignal-javascript/commit/fb189a550b0015a893e368dc92b07b94ff9a01ae)) | ||
## 1.3.30 | ||
@@ -4,0 +12,0 @@ |
@@ -16,7 +16,7 @@ import type { Breadcrumb, JSClient, Hook } from "@appsignal/types"; | ||
send<T>(error: Error, fn?: (span: Span) => T): Promise<Span> | void; | ||
send(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
send(error: Error | ErrorEvent, tags?: object, namespace?: string): Promise<Span> | void; | ||
send(span: Span): Promise<Span> | void; | ||
sendError<T>(error: Error): Promise<Span> | void; | ||
sendError<T>(error: Error, callback: (span: Span) => T): Promise<Span> | void; | ||
sendError<T>(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
sendError<T>(error: Error | ErrorEvent): Promise<Span> | void; | ||
sendError<T>(error: Error | ErrorEvent, callback: (span: Span) => T): Promise<Span> | void; | ||
sendError<T>(error: Error | ErrorEvent, tags?: object, namespace?: string): Promise<Span> | void; | ||
use(plugin: Function): void; | ||
@@ -23,0 +23,0 @@ createSpan(fn?: (span: Span) => void): Span; |
@@ -42,16 +42,29 @@ "use strict"; | ||
var _this = this; | ||
if (!(data instanceof Error) && !(data instanceof span_1.Span)) { | ||
if (!(data instanceof Error) && | ||
!(data instanceof span_1.Span) && | ||
!(data && data.error instanceof Error)) { | ||
console.error("[APPSIGNAL]: Can't send error, given error is not a valid type"); | ||
return; | ||
} | ||
var error; | ||
if ("error" in data) { | ||
error = data.error; | ||
} | ||
else { | ||
error = data; | ||
} | ||
if (this.ignored.length !== 0) { | ||
if (data instanceof Error && | ||
this.ignored.some(function (el) { return el.test(data.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored an error: ".concat(data.message)); | ||
return; | ||
if (error && "message" in error) { | ||
if (this.ignored.some(function (el) { | ||
return el.test(error.message); | ||
})) { | ||
console.warn("[APPSIGNAL]: Ignored an error: ".concat(error.message)); | ||
return; | ||
} | ||
} | ||
if (data instanceof span_1.Span) { | ||
var error_1 = data.serialize().error; | ||
if (error_1.message && this.ignored.some(function (el) { return el.test(error_1.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored a span: ".concat(error_1.message)); | ||
if (error instanceof span_1.Span) { | ||
var serializedError_1 = error.serialize().error; | ||
if (serializedError_1.message && | ||
this.ignored.some(function (el) { return el.test(serializedError_1.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored a span: ".concat(serializedError_1.message)); | ||
return; | ||
@@ -61,3 +74,3 @@ } | ||
} | ||
var span = data instanceof span_1.Span ? data : this._createSpanFromError(data); | ||
var span = error instanceof span_1.Span ? error : this._createSpanFromError(error); | ||
if (this._hooks.decorators.length > 0) { | ||
@@ -64,0 +77,0 @@ core_1.compose.apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(this._hooks.decorators), false))(span); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.3.29"; | ||
export declare const VERSION = "1.3.30"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = "1.3.29"; | ||
exports.VERSION = "1.3.30"; | ||
//# sourceMappingURL=version.js.map |
@@ -16,7 +16,7 @@ import type { Breadcrumb, JSClient, Hook } from "@appsignal/types"; | ||
send<T>(error: Error, fn?: (span: Span) => T): Promise<Span> | void; | ||
send(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
send(error: Error | ErrorEvent, tags?: object, namespace?: string): Promise<Span> | void; | ||
send(span: Span): Promise<Span> | void; | ||
sendError<T>(error: Error): Promise<Span> | void; | ||
sendError<T>(error: Error, callback: (span: Span) => T): Promise<Span> | void; | ||
sendError<T>(error: Error, tags?: object, namespace?: string): Promise<Span> | void; | ||
sendError<T>(error: Error | ErrorEvent): Promise<Span> | void; | ||
sendError<T>(error: Error | ErrorEvent, callback: (span: Span) => T): Promise<Span> | void; | ||
sendError<T>(error: Error | ErrorEvent, tags?: object, namespace?: string): Promise<Span> | void; | ||
use(plugin: Function): void; | ||
@@ -23,0 +23,0 @@ createSpan(fn?: (span: Span) => void): Span; |
@@ -40,16 +40,29 @@ import { __assign, __awaiter, __generator, __read, __spreadArray } from "tslib"; | ||
var _this = this; | ||
if (!(data instanceof Error) && !(data instanceof Span)) { | ||
if (!(data instanceof Error) && | ||
!(data instanceof Span) && | ||
!(data && data.error instanceof Error)) { | ||
console.error("[APPSIGNAL]: Can't send error, given error is not a valid type"); | ||
return; | ||
} | ||
var error; | ||
if ("error" in data) { | ||
error = data.error; | ||
} | ||
else { | ||
error = data; | ||
} | ||
if (this.ignored.length !== 0) { | ||
if (data instanceof Error && | ||
this.ignored.some(function (el) { return el.test(data.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored an error: ".concat(data.message)); | ||
return; | ||
if (error && "message" in error) { | ||
if (this.ignored.some(function (el) { | ||
return el.test(error.message); | ||
})) { | ||
console.warn("[APPSIGNAL]: Ignored an error: ".concat(error.message)); | ||
return; | ||
} | ||
} | ||
if (data instanceof Span) { | ||
var error_1 = data.serialize().error; | ||
if (error_1.message && this.ignored.some(function (el) { return el.test(error_1.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored a span: ".concat(error_1.message)); | ||
if (error instanceof Span) { | ||
var serializedError_1 = error.serialize().error; | ||
if (serializedError_1.message && | ||
this.ignored.some(function (el) { return el.test(serializedError_1.message); })) { | ||
console.warn("[APPSIGNAL]: Ignored a span: ".concat(serializedError_1.message)); | ||
return; | ||
@@ -59,3 +72,3 @@ } | ||
} | ||
var span = data instanceof Span ? data : this._createSpanFromError(data); | ||
var span = error instanceof Span ? error : this._createSpanFromError(error); | ||
if (this._hooks.decorators.length > 0) { | ||
@@ -62,0 +75,0 @@ compose.apply(void 0, __spreadArray([], __read(this._hooks.decorators), false))(span); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.3.29"; | ||
export declare const VERSION = "1.3.30"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = "1.3.29"; | ||
export var VERSION = "1.3.30"; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@appsignal/javascript", | ||
"version": "1.3.30", | ||
"version": "1.3.31", | ||
"main": "dist/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160306
1465