cfug / cfug/dio

Developer should throw custom exception in interceptor

Open
#1,950 17 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

e: PR welcomed p: dio s: feature
Dominant language
Dart
Stars
12.8k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Request Statement

When i write a interceptor class extends Interceptor, in some case, i wish throw some exception to tell the developer some thing went wrong. so i throw a custom exception in override function 'onResponse', but this exception was catched by DioException, and this exception can not tell me more infomation about this error.

image
image

So, i wish this will be supported

Solution Brainstorm

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Interceptor.onResponse entry point and the current DioException handling path. Review the 17-comment discussion to determine the agreed behavior for custom exceptions, then define completion around preserving enough information for a custom exception thrown by an interceptor to be distinguishable from DioException.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.