-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
Server: Remove panic
s in tab
module
#1748
Server: Remove panic
s in tab
module
#1748
Conversation
Note to self: Must replace calls to |
33537e8
to
54d7903
Compare
d3b691b
to
445a51c
Compare
445a51c
to
835b198
Compare
@imsnif I changed the dependencies here in that I added the zellij crash dump
We could drop the second stack trace (since IMO it doesn't really contain anything hinting towards the error source), but I thought we keep it in case the Another bonus is that since the backtrace is part of the zellij error log
So we have all useful information in the logs directly and it doesn't get lost. I like it much better now, what's your opinion? |
ping, @imsnif |
835b198
to
452d030
Compare
I'll merge this now (if CI passes) since with the recent activity around error handling I expect merge conflicts to become much more frequent. We can still revert it before the next release when necessary, or I'll patch it as required. Note to self: Discuss whether we should drop |
@har7an - please please please wait for the KDL PR before merging! |
for converting `Result` types that don't satisfy `anyhow`s trait constraints (`Display + Send + Sync + 'static`) conveniently. An example of such a Result is the `SendError` returned from `send_to_plugins`, which sends `PluginInstruction`s as message type. One of the enum variants can contain a `mpsc::Sender`, which is `!Sync` and hence makes the whole `SendError` be `!Sync` in this case. Add an implementation for this case that takes the message and converts it into an error containing the message formatted as string, with the additional `ErrorContext` as anyhow context.
and apply error reporting via `anyhow` instead. Make all relevant functions return `Result`s where previously a panic could occur and attach error context.
to accept an optional 4th parameter, a literal "?". If present, this will append a `?` to the given closure verbatim to handle/propagate errors from within the generated macro code.
and apply appropriate error context and propagate errors further up.
created with `anyhow!`. Since these errors don't have an underlying cause, we describe the cause in the macro instead and then attach the error context as usual before `?`ing the error back up.
to capture error backtraces at the error origins (i.e. where we first receive an error and convert it to a `anyhow::Error`). Since we propagate error back up the call stack now, the place where we `unwrap` on errors doesn't match the place where the error originated. Hence, the callstack, too, is quite misleading since it contains barely any references of the functions that triggered the error. As a consequence, we have 2 backtraces now when zellij crashes: One from `anyhow` (that is implicitly attached to anyhows error reports), and one from the custom panic handler (which is displayed through `miette`).
in the output of miette. Since we record backtraces with `anyhow` now, we end up having two backtraces in the output: One from the `anyhow` error and one from the actual call to `panic`. Adds a comment explaining the situation and another "section" to the error output of miette: We print the backtrace from anyhow as "Stack backtrace", and the output from the panic handler as "Panic backtrace". We keep both for the (hopefully unlikely) case that the anyhow backtrace isn't existent, so we still have at least something to work with.
and leave the `panic`ing to the calling function instead.
which extended `active_tab!` by passing the client IDs to the closure. However, this isn't necessary because closures capture their environment already, and the client_id needn't be mutable.
452d030
to
e4d8d6a
Compare
that defaults to some default client_id if it isn't valid (e.g. when the ScreenInstruction is sent via CLI).
332b4b2
to
1f610a7
Compare
Removes all calls to
unwrap()
in the tab module ofzellij-server
. Makes all relevant functions returnResult
s instead, attaching error context where possible to trace error origins better. Also updates the code inserver::screen
to accept the newResult
s and attach context there, too.Related to #1734.
I want to test what it looks like first by provoking some errors in the code to see whether it's really any good.