{"library":"stacktrace-parser","title":"Stacktrace Parser","type":"library","description":"stacktrace-parser is a JavaScript library designed to parse stack traces from various JavaScript environments, including web browsers (even older ones like Internet Explorer) and Node.js. It transforms raw stack trace strings into a structured array of objects, where each object represents a line in the stack and contains properties like `lineNumber`, `methodName`, `arguments`, `file`, and `column`. The current stable version is 0.1.11, last published approximately one year ago (as of early 2025). This package appears to be in a maintenance mode, with its low version number and infrequent updates suggesting a stable but not actively developed state, though a TODO list mentions a future v0.3. Its primary differentiator is its broad support for diverse stack trace formats across different JavaScript runtimes, providing a consistent, normalized output for error reporting and debugging tools, including built-in TypeScript type definitions.","language":"javascript","status":"maintenance","last_verified":"Sun Apr 19","install":{"commands":["npm install stacktrace-parser"],"cli":null},"imports":["import * as stackTraceParser from 'stacktrace-parser';","const stackTraceParser = require('stacktrace-parser');","import type { StackFrame } from 'stacktrace-parser';"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/errwischt/stacktrace-parser","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/stacktrace-parser","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import { parse } from 'stacktrace-parser';\n\nfunction performOperation(a: number, b: number): number {\n  if (b === 0) {\n    throw new Error('Division by zero is not allowed. Please provide a non-zero divisor.');\n  }\n  const result = a / b;\n  console.log(`Operation result: ${result}`);\n  return result;\n}\n\ntry {\n  // Intentionally cause an error to generate a stack trace\n  performOperation(10, 0);\n} catch (ex: any) {\n  console.error('An unexpected error occurred during operation:');\n  console.error('Error message:', ex.message);\n  console.error('--- Raw Stack Trace ---');\n  console.error(ex.stack);\n\n  if (ex.stack) {\n    console.log('\\n--- Parsed Stack Trace ---');\n    const parsedStack = parse(ex.stack);\n    parsedStack.forEach((frame, index) => {\n      console.log(`  Frame ${index}:`);\n      console.log(`    Method: ${frame.methodName}`);\n      console.log(`    File: ${frame.file || 'unknown'}:${frame.lineNumber || '?'}:${frame.column || '?'}`);\n      if (frame.arguments && frame.arguments.length > 0) {\n        console.log(`    Args: [${frame.arguments.join(', ')}]`);\n      }\n    });\n  } else {\n    console.warn('Error object did not contain a stack trace to parse.');\n  }\n}\n","lang":"typescript","description":"This quickstart demonstrates how to import and use `stacktrace-parser` to parse an error's stack trace into a structured, readable format.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}