coady / multimethod

Multiple argument dispatching.
https://coady.github.io/multimethod
Other
284 stars 23 forks source link

Improve dispatch exception handling #33

Closed cjalmeida closed 3 years ago

cjalmeida commented 3 years ago

While developing a non-trivial library, it can be hard to pinpoint exactly what function is giving TypeError due to extra/missing args. This PR add TypeErrors to a DispatchError chain that prints the file/lineno that raised the error.

codecov[bot] commented 3 years ago

Codecov Report

Merging #33 (4ecca90) into main (14c2946) will increase coverage by 100.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           main       #33        +/-   ##
===========================================
+ Coverage      0   100.00%   +100.00%     
===========================================
  Files         0         1         +1     
  Lines         0       202       +202     
  Branches      0        36        +36     
===========================================
+ Hits          0       202       +202     
Impacted Files Coverage Δ
multimethod/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 14c2946...4ecca90. Read the comment docs.

coady commented 3 years ago

I'm sure about it being a DispatchError because it did technically dispatch. Can you add a test? Thanks.

cjalmeida commented 3 years ago

Added tests