mitmproxy icon indicating copy to clipboard operation
mitmproxy copied to clipboard

Add error type / code enum

Open Prinzhorn opened this issue 4 years ago • 3 comments

Problem Description

In v6 when a *_disconnected event occurred I marked all active flows as aborted. Now in v7 closing a connection triggers an error event for these flows which it did not before. That sounds good to me, but I'd like to differentiate different errors better.

Proposal

Add a type or code to mitmproxy.flow.Error. I think msg is for humans and I'd like a precise way to determine the type of error like "interrupted connections, timeouts, or protocol errors" This would also serve as implicit documentation about which types of errors exist in mitmproxy land.

Alternatives

Checking the msg which is fragile. Also having the enum gives you an exact list of errors that can occur at all.

Prinzhorn avatar Apr 07 '21 17:04 Prinzhorn

Just parking this here

https://github.com/mitmproxy/mitmproxy/blob/fbcffee87f6ca0e8a4bb48123ddd7778ae64a946/mitmproxy/flow.py#L28

Prinzhorn avatar Aug 10 '22 16:08 Prinzhorn

Hi, I would like to work on this fix , is this already taken care as part of other bug or still needs to be worked on ?

snehanemadi avatar Mar 28 '24 14:03 snehanemadi

@snehanemadi feel free to look into this!

Prinzhorn avatar Apr 25 '24 17:04 Prinzhorn