cfug/diox

DioError doesn't implements Exception

Closed this issue · 2 comments

Request Statement

There's a reason why DioError doesn't implements Exception anymore? this is leading to uncaught exceptions.

On dio package I only needed to catch Exception, with diox I need to catch Exception and DioError.

try { ... } on DioError catch (e) { ... } on Exception catch (e) { ... }

Solution Brainstorm

No response

ueman commented

Can you explain why it's important to implement Exception? I'm curious since there's no need in Dart to subclass exception to throw an exception. So in order to catch everything you do just try { ... } catch (e, s) { ... }. I'm not against this change or anything, I just want to understand the problem a bit more.

Not a big deal, it's just cause I've a lot of code wich I explicitly catch on Exception, so, it won't catch DioError if it do not subclass Exception. I could just remove on clause, but I wanted to know why.