Skip to content

Commit 51cc9d4

Browse files
committed
fix(js-catcher): allow optional context and set statusCode on fetch fail
1 parent cc3f317 commit 51cc9d4

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

packages/javascript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hawk.so/javascript",
3-
"version": "3.2.13",
3+
"version": "3.2.14",
44
"description": "JavaScript errors tracking for Hawk.so",
55
"files": [
66
"dist"

packages/javascript/src/addons/breadcrumbs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ export class BreadcrumbManager {
403403
data: {
404404
url,
405405
method,
406+
statusCode: 0,
406407
durationMs: duration,
407408
error: error instanceof Error ? error.message : String(error),
408409
},

packages/javascript/src/utils/validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function validateUser(user: AffectedUser): boolean {
3030
* @param context
3131
*/
3232
export function validateContext(context: EventContext | undefined): boolean {
33-
if (!context || !Sanitizer.isObject(context)) {
33+
if (context && !Sanitizer.isObject(context)) {
3434
log('validateContext: Context must be an object', 'warn');
3535

3636
return false;

0 commit comments

Comments
 (0)