Skip to content

Conversation

Copy link

Copilot AI commented Dec 15, 2025

Error payloads now only contained error.name and error.message. Node.js errors carry additional diagnostic fields like error codes (ERR_INVALID_ARG_TYPE), SystemError fields (path, errno, syscall), and custom properties that are lost.

Changes

src/modules/event.ts

  • Added getAddons() to extract all error properties except name, message, stack
  • Added isSerializable() to filter non-JSON-serializable values (functions, symbols, circular refs)

src/index.ts

  • Include addons in payload when additional error properties exist

Example

// SystemError now includes diagnostic fields
try {
  fs.readFileSync('/nonexistent/path');
} catch (error) {
  HawkCatcher.send(error);
  // Payload now includes:
  // addons: {
  //   code: "ENOENT",
  //   errno: -2,
  //   syscall: "open",
  //   path: "/nonexistent/path"
  // }
}

// Custom error properties are captured
const err = new Error('DB connection failed');
err.code = 'DB_CONNECTION_ERROR';
err.retryable = true;
HawkCatcher.send(err);
// Payload includes: addons: { code: "DB_CONNECTION_ERROR", retryable: true }

Sensitive data filtering via beforeSend hook remains available.

Original prompt

This section details on the original issue you should resolve

<issue_title>Provide more detailed error in payload</issue_title>
<issue_description>Now only error.message and error.name got sent.

Need to include:

  • Error codes
  • additional fields of error, like in SystemError (path, info, errno, etc)
  • comply to existing schema</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Provide more detailed error information in payload Capture error codes and additional fields in payload addons Dec 15, 2025
Copilot AI requested a review from neSpecc December 15, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide more detailed error in payload

2 participants