@snapfail/browser 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collectors/errors.d.ts +1 -0
- package/dist/index.js +6 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4227,7 +4227,7 @@ function buildPayload(config, error, buffers) {
|
|
|
4227
4227
|
}
|
|
4228
4228
|
|
|
4229
4229
|
// src/collectors/errors.ts
|
|
4230
|
-
function
|
|
4230
|
+
function parseStackFromError(stack) {
|
|
4231
4231
|
if (!stack)
|
|
4232
4232
|
return [];
|
|
4233
4233
|
return stack.split(`
|
|
@@ -4248,7 +4248,7 @@ function fromError(err) {
|
|
|
4248
4248
|
return {
|
|
4249
4249
|
type: err.name || "Error",
|
|
4250
4250
|
message: err.message,
|
|
4251
|
-
stack:
|
|
4251
|
+
stack: parseStackFromError(err.stack)
|
|
4252
4252
|
};
|
|
4253
4253
|
}
|
|
4254
4254
|
return { type: "UnknownError", message: String(err), stack: [] };
|
|
@@ -4494,6 +4494,9 @@ async function send(endpoint, payload) {
|
|
|
4494
4494
|
|
|
4495
4495
|
// src/index.ts
|
|
4496
4496
|
function initSnapfail(config) {
|
|
4497
|
+
if (!config.projectKey) {
|
|
4498
|
+
return { capture() {}, destroy() {} };
|
|
4499
|
+
}
|
|
4497
4500
|
const windowMs = (config.bufferSeconds ?? 15) * 1000;
|
|
4498
4501
|
const consoleBuffer = new RingBuffer(windowMs);
|
|
4499
4502
|
const networkBuffer = new RingBuffer(windowMs);
|
|
@@ -4526,7 +4529,7 @@ function initSnapfail(config) {
|
|
|
4526
4529
|
}
|
|
4527
4530
|
function fromError2(error) {
|
|
4528
4531
|
if (error instanceof Error) {
|
|
4529
|
-
return { type: error.name || "Error", message: error.message, stack:
|
|
4532
|
+
return { type: error.name || "Error", message: error.message, stack: parseStackFromError(error.stack) };
|
|
4530
4533
|
}
|
|
4531
4534
|
return { type: "UnknownError", message: String(error), stack: [] };
|
|
4532
4535
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snapfail/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Browser SDK for snapfail — error capture, replay and transport",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
"prepublishOnly": "bun run build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@snapfail/protocol": "
|
|
26
|
+
"@snapfail/protocol": ">=0.0.1"
|
|
27
27
|
}
|
|
28
28
|
}
|