Skip to content

Add an option to disable exceptions #325

@ecyrbe

Description

@ecyrbe

Today for error handling, since we use exceptions, we need to use error handling helpers (ie isErrorFromAlias and isErrorFromPath) to check errors safely.
To improve error handling, we could also have the hability to disable exceptions and then return an object encapsulating the result.
This way, we can directly return a typed error without requiring to use a helper.

const client = new Zodios(baseurl, myApi, { enableExceptions: false } );
const { data: users, error } = await client.getUsers();
if( error ) {
  // typed error
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpinnedissues that should not be closed by botv11 target

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions