Skip to content

Some intercepted errors are lost. #229

@carlduranleau

Description

@carlduranleau

When intercepting an error in a try...catch block, the error should never be lost. I'm currently trying to debug an issue with DefaultDIDAdapter from another project, but the only error I get doesn't have any source, or "caused by".

Here's the actual code from DefaultDIDAdapter:

        try {
            return await this.performRequest(this.rpcEndpoint, request);
        } catch (e) {
            throw new NetworkException("Network error.");
        }

The catch block only forwards the error, but it should instead wrap it like this:

throw new NetworkException("Network error.", e);

This way, the source isn't lost.

This is only an example, but there are many other missing errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions