pub enum RsGuardError {
GitHubApi {
status: u16,
message: String,
},
LlmApi {
provider: String,
status: u16,
message: String,
},
VerdictParse(String),
Config(String),
Io(Error),
DiffTooLarge {
size_bytes: usize,
line_count: usize,
},
EmptyDiff,
InvalidDiffContent,
PermissionDenied {
state: String,
message: String,
},
}Expand description
Unified error type for all rs-guard operations.
Variants§
GitHubApi
GitHub REST API returned an error response.
Fields
LlmApi
LLM provider API returned an error response.
Fields
VerdictParse(String)
Failed to parse the verdict metadata block from an LLM response.
Config(String)
Configuration is invalid or a required value is missing.
Io(Error)
An I/O operation failed.
DiffTooLarge
The PR diff exceeds the maximum allowed size.
EmptyDiff
The diff contained no content.
InvalidDiffContent
The diff response did not contain valid diff content (e.g. received JSON error body).
PermissionDenied
The GitHub token lacks permission to perform the requested review action.
Implementations§
Source§impl RsGuardError
impl RsGuardError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is transient and the operation should be retried.
Retryable conditions:
- HTTP 429 (rate limited), 502, 503, or 504
- Status 0 (connection error, timeout, DNS failure)
Sourcepub fn is_permission_denied(&self) -> bool
pub fn is_permission_denied(&self) -> bool
Returns true if this error indicates insufficient GitHub permissions.
Trait Implementations§
Source§impl Debug for RsGuardError
impl Debug for RsGuardError
Source§impl Display for RsGuardError
impl Display for RsGuardError
Source§impl Error for RsGuardError
impl Error for RsGuardError
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<Error> for RsGuardError
impl From<Error> for RsGuardError
Auto Trait Implementations§
impl !RefUnwindSafe for RsGuardError
impl !UnwindSafe for RsGuardError
impl Freeze for RsGuardError
impl Send for RsGuardError
impl Sync for RsGuardError
impl Unpin for RsGuardError
impl UnsafeUnpin for RsGuardError
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