Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: make EmitLoop error message clearer #232

Merged
merged 12 commits into from
Nov 9, 2023

Conversation

tlambert03
Copy link
Member

@tlambert03 tlambert03 commented Sep 12, 2023

trying to make tracebacks in emit loop errors slightly clearer:

Traceback (most recent call last):
  File "/Users/talley/dev/self/psygnal/src/psygnal/_signal.py", line 990, in _run_emit_loop
    caller.cb(args)
  File "/Users/talley/dev/self/psygnal/src/psygnal/_weak_callback.py", line 324, in cb
    self._f(*self._args, *args, **self._kwargs)
  File "/Users/talley/dev/self/psygnal/x.py", line 22, in f1
    f2()
  File "/Users/talley/dev/self/psygnal/x.py", line 26, in f2
    f3()
  File "/Users/talley/dev/self/psygnal/x.py", line 30, in f3
    raise ValueError("oops")
ValueError: oops

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/talley/dev/self/psygnal/x.py", line 34, in <module>
    thing.sig.emit(1)
  File "/Users/talley/dev/self/psygnal/src/psygnal/_signal.py", line 945, in emit
    self._run_emit_loop(args)
  File "/Users/talley/dev/self/psygnal/src/psygnal/_signal.py", line 992, in _run_emit_loop
    raise EmitLoopError(
psygnal._exceptions.EmitLoopError:
While emitting signal '__main__.Thing.sig', an error occurred in callback '__main__.f1'.
The args passed to the callback were: (1,)
This is not a bug in psygnal.  See 'ValueError' above for details.

@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b900ff2) 99.94% compared to head (998b6ce) 99.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #232      +/-   ##
==========================================
- Coverage   99.94%   99.89%   -0.06%     
==========================================
  Files          22       22              
  Lines        1873     1900      +27     
==========================================
+ Hits         1872     1898      +26     
- Misses          1        2       +1     
Files Coverage Δ
src/psygnal/_exceptions.py 100.00% <100.00%> (ø)
src/psygnal/_queue.py 100.00% <ø> (ø)
src/psygnal/_signal.py 100.00% <ø> (ø)
src/psygnal/_weak_callback.py 98.98% <100.00%> (-0.47%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 12, 2023

CodSpeed Performance Report

Merging #232 will degrade performances by 10.6%

Comparing tlambert03:slot-tb (998b6ce) with main (b900ff2)

Summary

⚡ 2 improvements
❌ 1 (👁 1) regressions
✅ 63 untouched benchmarks

Benchmarks breakdown

Benchmark main tlambert03:slot-tb Change
test_emit_time[lambda-2] 123.5 µs 110.9 µs +11.41%
👁 test_connect_time[setattr-check_types] 124.8 µs 139.6 µs -10.6%
test_emit_time[partial_method-2] 136.3 µs 122.9 µs +10.94%

@tlambert03 tlambert03 closed this Sep 12, 2023
@tlambert03 tlambert03 reopened this Sep 12, 2023
@tlambert03 tlambert03 changed the title refactor: adjust traceback of emit loop error refactor: make EmitLoop error message clearer Nov 9, 2023
@tlambert03 tlambert03 enabled auto-merge (squash) November 9, 2023 20:32
@tlambert03 tlambert03 disabled auto-merge November 9, 2023 20:36
@tlambert03 tlambert03 merged commit 5602780 into pyapp-kit:main Nov 9, 2023
27 of 28 checks passed
@tlambert03 tlambert03 deleted the slot-tb branch November 9, 2023 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant