Skip to content

Custom error details #87

@burdiyan

Description

@burdiyan

The protocol spec for the error expression is closely tied to JavaScript's Error type, and is not very extensible with custom parameters. The spec says:

TODO: We should extend this to encode own properties that have been added to the error.

I wonder what are the plans for supporting the extensibility? Would it be defined as a separate expression type, or just an extension of the existing error message?

In my case, I'm experimenting with implementing the server side of Cap'n Web in a different language (Go), and JS-specific error types, besides feeling weird, are also quite limiting — no way to specify error codes, or custom attributes.

I was thinking the extra attributes in JSON and put them into the error message as a string, but it's ugly, and I don't like it.

Maybe one way to support the extensibility could be allowing to use string | object as message in the error expression? This should probably only be supported if type is a non-standard JS error type.

CC: @kentonv.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions