Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 898 Bytes

File metadata and controls

27 lines (21 loc) · 898 Bytes
title parseCS()
order 2

Parsing stack traces but with callsites

Stacklyn.parseCS(error: object, opts?: object)

Now typically you don't need to call this function manually (since its called by the ALLOW_cALLSITES option in .parse()), its still a very useful function.

Options inside the opts object

  • FULL_ERROR (default: false): Includes the rest of the error object serialized. (same as in .parse())

Example

try {
    // some code that might throw an error
} catch (error) {
    const parsed = Stacklyn.parseCS(error);
    const rawFrames = parsed.callSites;
    const sourceCode = rawFrames[0].sourceCode;

    // do some stuff with the amazing info you just got about the misbehaving code
}

If you want to know more about the output structure of this method, check out Output of .parse().