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

Move handler methods from infallible calls to Result<_,_> #34

Closed
wants to merge 3 commits into from

Conversation

slawlor
Copy link
Owner

@slawlor slawlor commented Jan 27, 2023

Blocked on #32 after that merges, rebase and put up for review.

This PR moves all of the handler methods

pre_start(..)
post_start(..)
post_stop(..)
handle(..)
handle_supervision_evt(..)

to return types that return

-> Result<_, ActorProcessingErr> {}

which is type alias for

pub type ActorProcessingErr = Box<dyn std::error::Error + Send + Sync + 'static>;

which allows us to auto-convert almost anything that implements the Error trait and bubble it up to the supervisor with all associated information.

…y on the Erlang

protocol.

This is a collection of tcp managing actors and session management for automated session
handling

Related issue: #16
@codecov
Copy link

codecov bot commented Jan 27, 2023

Codecov Report

Base: 86.18% // Head: 63.55% // Decreases project coverage by -22.64% ⚠️

Coverage data is based on head (b2bb1cc) compared to base (59e6ff8).
Patch coverage: 48.13% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #34       +/-   ##
===========================================
- Coverage   86.18%   63.55%   -22.64%     
===========================================
  Files          25       40       +15     
  Lines        2331     5092     +2761     
===========================================
+ Hits         2009     3236     +1227     
- Misses        322     1856     +1534     
Impacted Files Coverage Δ
ractor/src/actor/errors.rs 69.04% <0.00%> (+1.60%) ⬆️
ractor/src/concurrency.rs 96.42% <ø> (ø)
ractor_cluster/src/hash.rs 0.00% <0.00%> (ø)
ractor_cluster/src/net/listener.rs 0.00% <0.00%> (ø)
ractor_cluster/src/net/session.rs 0.00% <0.00%> (ø)
ractor_cluster/src/node/auth.rs 0.00% <0.00%> (ø)
ractor_cluster/src/node/client.rs 0.00% <0.00%> (ø)
ractor_cluster/src/node/mod.rs 0.00% <0.00%> (ø)
ractor_cluster/src/node/node_session.rs 0.00% <0.00%> (ø)
ractor_cluster/src/remote_actor/mod.rs 0.00% <0.00%> (ø)
... and 36 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@slawlor slawlor changed the title Move calls to Result<_,_> Move handler methods from infallible calls to Result<_,_> Jan 27, 2023
This change migrates changes to using `Result<_,_>` return types for actor handlers, to minimize calling `panic!`s. This additionally passes dyn Errors up to handlers so supervisors can handle extended error information cleanly.

Resolves #33
@slawlor
Copy link
Owner Author

slawlor commented Jan 27, 2023

Closed in favor of #35

@slawlor slawlor closed this Jan 27, 2023
@slawlor slawlor deleted the results branch January 27, 2023 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant