Skip to content

Custom error class / raise errors with detailed error messages #53

@pr130

Description

@pr130

I realized that the server actually gives a more helpful error message in the body in the response, e.g. here

    body:
      encoding: UTF-8
      file: no
      string: '{"detail":"Invalid token."}'

in this case, the added value is not as obvious. a better example: i tried to get submissions for a survey but it didn't work because the asset was not deployed yet. the string then contained something like "the asset is not deployed yet" while the error raised by raise_for_status was just a 404 not found (or 400 invalid request, don't remember exactly).

not sure this is worth the effort though. alternatively, we could just check for the status code and then raise a simple usethis::ui_stop that combines the status code, the status message and the detailed "detail" message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    low level API interfaceFeature Low Level API InterfacequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions