diff options
author | har7an <99636919+har7an@users.noreply.github.com> | 2022-11-08 10:56:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-08 10:56:23 +0000 |
commit | 453142775c96752730d7caf85532e616e2aaa719 (patch) | |
tree | 607aff5d44ec5894fa98b7e4d108f8bb2815684c /zellij-server/src/tab | |
parent | 39c8d97054ff5a2745df455666dc2decd1fefc0e (diff) |
errors: Remove `log::error` in server (#1881)
* server/wasm_vm: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
* server/tab: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
* server/route: Replace `log::error!`
and propagate the error to the caller instead.
* server/pty: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
Also add per-instruction error context to make it clear what we tried to
accomplish when an error occured.
* server/panes/tiled_panes: Merge dependencies
and sort them into a better order.
* server/panes/tiled_panes: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
* server/os_input_output: Merge depndencies
and sort them into a better order.
* server/logging_pipe: Replace `log::error!`
with better error logging by means of `non_fatal`. This preserves the
original error and allows adding context information on top. Also makes
error formatting more uniform across the application.
* server/os_io: Remove uses of `log::error`
* changelog: Add PR #1881
* server/os_io: Gracefully handle failing resize
for terminals IDs that don't exist, instead of propagating the error to
the user.
* server/lib: Remove leftover log message
* server/pty: Log error cause
rather than providing a hard-coded error reason which is plain wrong in
this context.
* server/screen: Remove calls to `log::error!`
and change `get_active_tab(_mut)?` to return a `Result` instead of an
`Option`. This already makes many places in the code obsolete where
previously "failed to get active tab..." was logged manually.
Rather than logging, use the `anyhow::Error`s we have, along with all
their context information, and log these instead.
Diffstat (limited to 'zellij-server/src/tab')
-rw-r--r-- | zellij-server/src/tab/mod.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index 9546f2201..618c2b35d 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -490,10 +490,13 @@ impl Tab { "failed to apply layout {layout:#?} in tab {tab_index} for client id {client_id}" ) }; + if self.tiled_panes.has_panes() { - log::error!( + Err::<(), _>(anyhow!( "Applying a layout to a tab with existing panes - this is not yet supported!" - ); + )) + .with_context(err_context) + .non_fatal(); } let (viewport_cols, viewport_rows) = { let viewport = self.viewport.borrow(); @@ -620,7 +623,9 @@ impl Tab { .send_to_pty(PtyInstruction::ClosePane(PaneId::Terminal(unused_pid))) .with_context(err_context)?; } - log::error!("{}", e); // TODO: propagate this to the user + Err::<(), _>(anyError::msg(e)) + .with_context(err_context) + .non_fatal(); // TODO: propagate this to the user Ok(()) }, } @@ -934,7 +939,11 @@ impl Tab { .with_context(err_context)?; }, None => { - log::error!("Could not find editor pane to replace - is no pane focused?") + Err::<(), _>(anyhow!( + "Could not find editor pane to replace - is no pane focused?" + )) + .with_context(err_context) + .non_fatal(); }, } }, |