pub struct CLIJSONDecodeError {
pub line: String,
pub original_error: String,
pub preview: String,
}Expand description
Error decoding JSON from the CLI stdout stream.
Raised when the CLI outputs invalid JSON or when a JSON message exceeds the configured buffer size.
Fields§
§line: StringThe raw line that failed to parse.
original_error: StringThe original parsing error description.
preview: StringA preview of the raw line (first 100 characters).
Implementations§
Source§impl CLIJSONDecodeError
impl CLIJSONDecodeError
Sourcepub fn new(line: impl Into<String>, original_error: impl Into<String>) -> Self
pub fn new(line: impl Into<String>, original_error: impl Into<String>) -> Self
Creates a new CLIJSONDecodeError with the raw line and error description.
§Example
use claude_code::CLIJSONDecodeError;
let err = CLIJSONDecodeError::new("{bad json}", "expected value");
assert!(err.preview.contains("{bad json}"));Trait Implementations§
Source§impl Clone for CLIJSONDecodeError
impl Clone for CLIJSONDecodeError
Source§fn clone(&self) -> CLIJSONDecodeError
fn clone(&self) -> CLIJSONDecodeError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CLIJSONDecodeError
impl Debug for CLIJSONDecodeError
Source§impl Display for CLIJSONDecodeError
impl Display for CLIJSONDecodeError
Source§impl Error for CLIJSONDecodeError
impl Error for CLIJSONDecodeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<CLIJSONDecodeError> for Error
impl From<CLIJSONDecodeError> for Error
Source§fn from(source: CLIJSONDecodeError) -> Self
fn from(source: CLIJSONDecodeError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for CLIJSONDecodeError
impl RefUnwindSafe for CLIJSONDecodeError
impl Send for CLIJSONDecodeError
impl Sync for CLIJSONDecodeError
impl Unpin for CLIJSONDecodeError
impl UnsafeUnpin for CLIJSONDecodeError
impl UnwindSafe for CLIJSONDecodeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more