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

errors: Don't unwrap in server::os_input_output #1895

Merged

Conversation

har7an
Copy link
Contributor

@har7an har7an commented Nov 2, 2022

Rewrites the os_input_output module to handle/propagate errors with anyhow::Error instead of unwrapping on all Result types. Also unifies all error types regarding this module to by anyhow::Error.

As part of this PR the previously existing SpawnTerminalError is entirely removed and replaced with a new ZellijError. Better documentation on that will follow in a subsequent PR.

to use `anyhow::Result` instead. This mostly makes the need of custom
`SpawnTerminalError` obsolete (tbd in subsequent commits) and unifies
error handling across the application.
to replace any previously defined, isolated custom error types
throughout the application. Currently implements all error variants
found in `SpawnTerminalError`.

In the long term, this will allow zellij to fall back to a single error
type for all application-specific errors, instead of having different
error types per module.
with updated `Result`-types.
with updated `Result`-types.
with updated `Result`-types.
rather than a `&'static str`, which isn't compatible with
`anyhow::Context`.
which is returned due to the changed return types in `ServerOsApi`.
originating in the change to the `ServerOsApi` trait definition.
originating in the change to the `ServerOsApi` trait definition.
originating in the change to the `ServerOsApi` trait definition.
originating in the change to the `ServerOsApi` trait definition.
originating in the change to the `ServerOsApi` trait definition. The
functions here don't return a `Result` yet, this is better left to a
follow-up PR.
and make use of the new `ZellijError` instead. Make use of `anyhow`s
downcast capabilities to restore the underlying original errors where
necessary, as was done previously. This gives us the flexibility to
attach context information to all errors while still allowing us to
handle specific errors in greater detail.
@har7an har7an force-pushed the errors/dont-unwrap-in-server-os-input-output branch from fa613bf to 147a706 Compare November 2, 2022 04:41
@har7an har7an temporarily deployed to cachix November 2, 2022 04:42 Inactive
@har7an har7an temporarily deployed to cachix November 2, 2022 05:03 Inactive
@har7an har7an merged commit e45a3e5 into zellij-org:main Nov 2, 2022
@har7an har7an deleted the errors/dont-unwrap-in-server-os-input-output branch December 13, 2022 07:27
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