Skip to content

Enhancement: Adding Failed Body for extended error objects #2061

@zachlevy

Description

@zachlevy

I'm sure a lot of projects, including a couple of mine, use extended Error objects

A simple example would be

const err = new Error('An error message');
err.code = 'SOME_APP_ERROR_CODE';
> JSON.stringify(err);
'{"code":"SOME_APP_ERROR_CODE"}'

https://github.com/goldbergyoni/nodebestpractices/blob/master/sections/errorhandling/useonlythebuiltinerror.md#use-only-the-built-in-error-object

In bull, when saving a failed job processing attempt, it stores the stack trace and the error message, it would be great to store any extended error attributes also.

params.failedReason = err.message;
params.failedBody = JSON.stringify(err);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions