Skip to content

Error Handling in API Requests #33

@runeharlyk

Description

@runeharlyk

Problem

Currently if a request fails the end user does not get notified of the result of the request.
Most fetch call is wrapped in a try catch that silently logs the error with console.error().

Proposal

An api service, which handles the unsuccessful requests and return a typed response. Something like:

await get<Networks>('/rest/listNetworks')

The service should:

  • Fetch the data with appropriate authentication
  • Notify the user (maybe via toast service) of any errors that occurred
  • Cast the json response to T type
  • return the data

Let me know if you are interested in the proposed feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions