Improving error messages when we cannot deconvert a type.#366
Merged
slawlor merged 1 commit intoslawlor:mainfrom Jul 23, 2025
Merged
Improving error messages when we cannot deconvert a type.#366slawlor merged 1 commit intoslawlor:mainfrom
slawlor merged 1 commit intoslawlor:mainfrom
Conversation
slawlor
approved these changes
Jul 15, 2025
Owner
|
can you run clippy and update the PR? Thanks! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #366 +/- ##
=======================================
Coverage ? 82.28%
=======================================
Files ? 70
Lines ? 12765
Branches ? 0
=======================================
Hits ? 10504
Misses ? 2261
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
I've just taken a look at the clippy warnings, and it doesn't look like they're related to this change. They're about using the newer-style inline variable names in format strings: I can fix those if you'd like, but it might belong in a different PR? |
Owner
|
Yeah please just lint the whole project. It's the typical flow even if it is touching some other code to keep the lib up to date. Thanks! |
When you send a message to a `DerivedActor`, we convert the message to
the receiver's type. If the message sending fails, we deconvert it to
show you which message failed. However, if the deconversion fails, you
get a very terse error message:
```log
PANIC: Failed to deconvert message to from type
```
Obviously that provides very little diagnostic information. This change
greatly improves the error to something like:
```log
PANIC: Failed to deconvert message from klite::queries::query_watcher::QueryWatcherMessage to klite::connection_manager::ClientResponse when sending back to: Actor { name: Some("current_subscribers.sql"), id: Local(8) }
```
Now you know exactly which kind of message was sent to whom, and which
`TryFrom` instance you need to fix.
(NOTE: These errors should be very rare. `TryFrom` _should_ be
implemented properly. But when very rare errors happen that's exactly
when you need very good error messages.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When you send a message to a
DerivedActor, we convert the message to the receiver's type. If the message sending fails, we deconvert it to show you which message failed. However, if the deconversion fails, you get a very terse error message:Obviously that provides very little diagnostic information. This change greatly improves the error to something like:
Now you know exactly which kind of message was sent to whom, and which
TryFrominstance you need to fix.(NOTE: These errors should be very rare.
TryFromshould be implemented properly. But when very rare errors happen that's exactly when you need very good error messages.)