From 53f9820a93e2fdc78001d48f23d962fd376803e9 Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Sun, 18 Feb 2024 08:31:36 +0100 Subject: [PATCH] Prune unused `ShellError` variants (#11883) # Description Same procedure as #11881 Remove unused variants to avoid confusion and foster better practices around error variants. - Remove `SE::PermissionDeniedError` - Remove `SE::OutOfMemoryError` - Remove `SE::DirectoryNotFoundCustom` - Remove `SE::MoveNotPossibleSingle` - Remove `SE::NonUnicodeInput` # User-Facing Changes Plugin authors may have matched against or emitted those variants --- crates/nu-protocol/src/shell_error.rs | 64 --------------------------- 1 file changed, 64 deletions(-) diff --git a/crates/nu-protocol/src/shell_error.rs b/crates/nu-protocol/src/shell_error.rs index d4549766b734..e94b0063a2c0 100644 --- a/crates/nu-protocol/src/shell_error.rs +++ b/crates/nu-protocol/src/shell_error.rs @@ -808,32 +808,6 @@ pub enum ShellError { span: Span, }, - /// Permission for an operation was denied. - /// - /// ## Resolution - /// - /// This is a generic error. Refer to the specific error message for further details. - #[error("Permission Denied")] - #[diagnostic(code(nu::shell::permission_denied))] - PermissionDeniedError { - msg: String, - #[label("{msg}")] - span: Span, - }, - - /// Out of memory. - /// - /// ## Resolution - /// - /// This is a generic error. Refer to the specific error message for further details. - #[error("Out of memory")] - #[diagnostic(code(nu::shell::out_of_memory))] - OutOfMemoryError { - msg: String, - #[label("{msg}")] - span: Span, - }, - /// Tried to `cd` to a path that isn't a directory. /// /// ## Resolution @@ -859,19 +833,6 @@ pub enum ShellError { span: Span, }, - /// Attempted to perform an operation on a directory that doesn't exist. - /// - /// ## Resolution - /// - /// Make sure the directory in the error message actually exists before trying again. - #[error("Directory not found")] - #[diagnostic(code(nu::shell::directory_not_found_custom))] - DirectoryNotFoundCustom { - msg: String, - #[label("{msg}")] - span: Span, - }, - /// The requested move operation cannot be completed. This is typically because both paths exist, /// but are of different types. For example, you might be trying to overwrite an existing file with /// a directory. @@ -890,22 +851,6 @@ pub enum ShellError { destination_span: Span, }, - /// The requested move operation cannot be completed. This is typically because both paths exist, - /// but are of different types. For example, you might be trying to overwrite an existing file with - /// a directory. - /// - /// ## Resolution - /// - /// Make sure the destination path does not exist before moving a directory. - #[error("Move not possible")] - #[diagnostic(code(nu::shell::move_not_possible_single))] - // NOTE: Currently not actively used. - MoveNotPossibleSingle { - msg: String, - #[label("{msg}")] - span: Span, - }, - /// Failed to create either a file or directory. /// /// ## Resolution @@ -1115,15 +1060,6 @@ pub enum ShellError { span: Span, }, - /// Non-Unicode input received. - /// - /// ## Resolution - /// - /// Check that your path is UTF-8 compatible. - #[error("Non-Unicode input received.")] - #[diagnostic(code(nu::shell::non_unicode_input))] - NonUnicodeInput, - // It should be only used by commands accepts block, and accept inputs from pipeline. /// Failed to eval block with specific pipeline input. #[error("Eval block failed with pipeline input")]