Skip to content

Commit

Permalink
Prune unused ShellError variants (nushell#11883)
Browse files Browse the repository at this point in the history
# Description
Same procedure as nushell#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
  • Loading branch information
sholderbach authored and kik4444 committed Feb 28, 2024
1 parent 2423ea4 commit 53f9820
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions crates/nu-protocol/src/shell_error.rs
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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")]
Expand Down

0 comments on commit 53f9820

Please sign in to comment.