-
Notifications
You must be signed in to change notification settings - Fork 74
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
clipboard
: add error handling based on clipboard::Error
#1970
Conversation
src/cmd/clipboard.rs
Outdated
arboard::Error::ClipboardNotSupported => CliError::Other(format!( | ||
"The clipboard may not be supported for the current environment." | ||
)), |
Check warning
Code scanning / clippy
useless use of format! Warning
src/cmd/clipboard.rs
Outdated
arboard::Error::ConversionFailure => CliError::Other(format!( | ||
"The content that was about the be transferred to/from the clipboard could not be \ | ||
converted to the appropriate format." | ||
)), |
Check warning
Code scanning / clippy
useless use of format! Warning
src/cmd/clipboard.rs
Outdated
arboard::Error::ClipboardOccupied => CliError::Other(format!( | ||
"The clipboard was unaccessible when attempting to access/use it. It may have \ | ||
been held by another process/thread." | ||
)), |
Check warning
Code scanning / clippy
useless use of format! Warning
src/cmd/clipboard.rs
Outdated
arboard::Error::ContentNotAvailable => CliError::Other(format!( | ||
"The clipboard contents were not available in the requested format. This could \ | ||
either be due to the clipboard being empty or the clipboard contents having an \ | ||
incompatible format to the requested one." | ||
)), |
Check warning
Code scanning / clippy
useless use of format! Warning
src/cmd/clipboard.rs
Outdated
arboard::Error::Unknown { description: _ } => CliError::Other(format!( | ||
"An unknown error occurred while attempting to use the clipboard." | ||
)), |
Check warning
Code scanning / clippy
useless use of format! Warning
src/cmd/clipboard.rs
Outdated
_ => CliError::Other(format!( | ||
"An unexpected error occurred while using the clipboard." | ||
)), |
Check warning
Code scanning / clippy
useless use of format! Warning
src/cmd/clipboard.rs
Outdated
fn from(err: arboard::Error) -> Self { | ||
match err { | ||
arboard::Error::ClipboardNotSupported => { | ||
CliError::Other("The clipboard may not be supported for the current environment.") |
Check failure
Code scanning / clippy
mismatched types Error
src/cmd/clipboard.rs
Outdated
fn from(err: arboard::Error) -> Self { | ||
match err { | ||
arboard::Error::ClipboardNotSupported => { | ||
CliError::Other("The clipboard may not be supported for the current environment.") |
Check failure
Code scanning / clippy
mismatched types Error
src/cmd/clipboard.rs
Outdated
"The content that was about the be transferred to/from the clipboard could not be \ | ||
converted to the appropriate format.", |
Check failure
Code scanning / clippy
mismatched types Error
arboard::Error::ClipboardNotSupported => { | ||
CliError::Other("The clipboard may not be supported for the current environment.") | ||
}, | ||
arboard::Error::ConversionFailure => CliError::Other( |
Check failure
Code scanning / clippy
mismatched types Error
src/cmd/clipboard.rs
Outdated
"The clipboard was unaccessible when attempting to access/use it. It may have \ | ||
been held by another process/thread.", |
Check failure
Code scanning / clippy
mismatched types Error
"The clipboard was unaccessible when attempting to access/use it. It may have \ | ||
been held by another process/thread.", | ||
), | ||
arboard::Error::ContentNotAvailable => CliError::Other( |
Check failure
Code scanning / clippy
mismatched types Error
src/cmd/clipboard.rs
Outdated
incompatible format to the requested one.", | ||
), | ||
arboard::Error::Unknown { description: _ } => { | ||
CliError::Other("An unknown error occurred while attempting to use the clipboard.") |
Check failure
Code scanning / clippy
mismatched types Error
src/cmd/clipboard.rs
Outdated
incompatible format to the requested one.", | ||
), | ||
arboard::Error::Unknown { description: _ } => { | ||
CliError::Other("An unknown error occurred while attempting to use the clipboard.") |
Check failure
Code scanning / clippy
mismatched types Error
src/cmd/clipboard.rs
Outdated
arboard::Error::Unknown { description: _ } => { | ||
CliError::Other("An unknown error occurred while attempting to use the clipboard.") | ||
}, | ||
_ => CliError::Other("An unexpected error occurred while using the clipboard."), |
Check failure
Code scanning / clippy
mismatched types Error
src/cmd/clipboard.rs
Outdated
arboard::Error::Unknown { description: _ } => { | ||
CliError::Other("An unknown error occurred while attempting to use the clipboard.") | ||
}, | ||
_ => CliError::Other("An unexpected error occurred while using the clipboard."), |
Check failure
Code scanning / clippy
mismatched types Error
Resolves #1969.