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

[ENH] catch panics in task operators #2450

Merged
merged 5 commits into from
Jul 10, 2024
Merged

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Jul 3, 2024

This can't share code with the handler panic-catching-impl because the task has its own reply channel that the handler knows nothing about.

Copy link

github-actions bot commented Jul 3, 2024

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@codetheweb codetheweb changed the base branch from main to feat-catch-panics-in-handlers July 3, 2024 22:05
.await;

// Re-panic so the message handler can catch it
panic!(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a little weird but I think this makes sense, since the panic technically happened within a component

@codetheweb codetheweb requested a review from HammadB July 3, 2024 22:12
@codetheweb codetheweb marked this pull request as ready for review July 3, 2024 22:12
@@ -46,3 +46,9 @@ pub(crate) trait ChromaError: Error + Send {
}

impl Error for Box<dyn ChromaError> {}

impl ChromaError for Box<dyn ChromaError> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you :)

@@ -17,16 +22,45 @@ where
async fn run(&self, input: &I) -> Result<O, Self::Error>;
}

#[derive(Debug, Error)]
pub(super) enum TaskError<Err> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may want to constrain Err to ChromaError here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding that bound results in needing to add a lot of spurious typings, so imo it's ok to leave it unbounded and introduce it if there's an issue later
anywhere that calls .boxed() or .code() already effectively constrains it

Base automatically changed from feat-catch-panics-in-handlers to main July 9, 2024 21:27
@HammadB
Copy link
Collaborator

HammadB commented Jul 10, 2024 via email

@codetheweb codetheweb merged commit 27f7d1a into main Jul 10, 2024
65 checks passed
@codetheweb codetheweb deleted the feat-task-execution-errors branch July 10, 2024 16:41
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.

2 participants