Skip to content

Commit

Permalink
fix: backtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekaN2 committed Dec 18, 2024
1 parent f487c62 commit eadf078
Show file tree
Hide file tree
Showing 4 changed files with 12,284 additions and 2,439 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"preinstall": "npx only-allow yarn"
},
"devDependencies": {
"@types/stack-trace": "^0.0.33",
"eslint": "^9.14.0",
"eslint-config-codex": "^2.0.3",
"rimraf": "^6.0.1",
Expand All @@ -28,5 +29,9 @@
"typescript-eslint": "^8.13.0",
"vitest": "^2.1.4"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"dependencies": {
"@hawk.so/types": "^0.1.21",
"stack-trace": "^1.0.0-pre2"
}
}
5 changes: 3 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HawkEvent, HawkNodeJSInitialSettings } from '../types';
import type { HawkEvent, HawkNodeJSInitialSettings } from '../types/index';

import {
EventContext,
Expand Down Expand Up @@ -54,6 +54,7 @@ class Catcher {
this.initGlobalHandlers();
}
} catch (error) {
console.log(error);
throw new Error('Invalid integration token');
}
}
Expand Down Expand Up @@ -219,7 +220,7 @@ export default class HawkCatcher {
*
* @param settings - If settings is a string, it means an Integration Token
*/
public static init(settings: HawkNodeJSInitialSettings | string): void {
public init(settings: HawkNodeJSInitialSettings | string): void {
_instance = new Catcher(settings);
}

Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/modules/backtrace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BacktraceFrame, SourceCodeLine } from '@hawk.so/types';
import fs from 'fs';
import stackTrace, { StackFrame } from 'stack-trace';

/**
Expand Down Expand Up @@ -104,12 +103,13 @@ export default class BacktraceHelper {
* @returns {string[]}
*/
private getSourceFileAsLines(filepath: string): string[] {
if (!fs.existsSync(filepath)) {
return [];
}
return [];
// if (!fs.existsSync(filepath)) {
// return [];
// }

return fs.readFileSync(filepath, 'utf-8')
.split('\n');
// return fs.readFileSync(filepath, 'utf-8')
// .split('\n');
}

/**
Expand Down
Loading

0 comments on commit eadf078

Please sign in to comment.