Skip to content

Refactor Stack Parsing #4543

Closed
Closed
@timfish

Description

@timfish

Currently the JavaScript stack parsing is made up of:

  • Highly modified version of Tracekit for the browser
  • Mildly modified version of node-stack-parse for node.js

These are currently working well but there is scope for improvement:

This quick PoC shows that the stack line parsers can be moved into individual functions that will allow features to be configurable.

Rough Plan

Make incremental improvements, starting with non-breaking changes:

Then breaking changes for next major version:

A stack parser that can handle both Chrome and Node.js frames might be constructed like:

import { createStackParser } from '@sentry/utils';
import { chrome } from '@sentry/browser';
import { node} from '@sentry/node';
import { Exception } from '@sentry.types';

const stackParser = createStackParser(chrome, node);

try {
  throw new Error('bad things');
} catch(e) {
  const ex: Exception = stackParser(e);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: browserIssues related to the Sentry Browser SDKPackage: nodeIssues related to the Sentry Node SDK

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions