refactor(deps): replace tokio Mutex/join!, add NetworkErrorKind enum, remove reqwest from error types
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
use serde::Serialize;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum NetworkErrorKind {
|
||||
Timeout,
|
||||
ConnectionRefused,
|
||||
DnsResolution,
|
||||
Tls,
|
||||
Other,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ErrorCode {
|
||||
ConfigNotFound,
|
||||
@@ -99,8 +108,8 @@ pub enum LoreError {
|
||||
#[error("Cannot connect to GitLab at {base_url}")]
|
||||
GitLabNetworkError {
|
||||
base_url: String,
|
||||
#[source]
|
||||
source: Option<reqwest::Error>,
|
||||
kind: NetworkErrorKind,
|
||||
detail: Option<String>,
|
||||
},
|
||||
|
||||
#[error(
|
||||
@@ -122,9 +131,6 @@ pub enum LoreError {
|
||||
#[error("Database error: {0}")]
|
||||
Database(#[from] rusqlite::Error),
|
||||
|
||||
#[error("HTTP error: {0}")]
|
||||
Http(#[from] reqwest::Error),
|
||||
|
||||
#[error("JSON error: {0}")]
|
||||
Json(#[from] serde_json::Error),
|
||||
|
||||
@@ -146,8 +152,7 @@ pub enum LoreError {
|
||||
#[error("Cannot connect to Ollama at {base_url}. Is it running?")]
|
||||
OllamaUnavailable {
|
||||
base_url: String,
|
||||
#[source]
|
||||
source: Option<reqwest::Error>,
|
||||
detail: Option<String>,
|
||||
},
|
||||
|
||||
#[error("Ollama model '{model}' not found. Run: ollama pull {model}")]
|
||||
@@ -187,7 +192,6 @@ impl LoreError {
|
||||
ErrorCode::DatabaseError
|
||||
}
|
||||
}
|
||||
Self::Http(_) => ErrorCode::GitLabNetworkError,
|
||||
Self::Json(_) => ErrorCode::InternalError,
|
||||
Self::Io(_) => ErrorCode::IoError,
|
||||
Self::Transform(_) => ErrorCode::TransformError,
|
||||
@@ -238,7 +242,6 @@ impl LoreError {
|
||||
Some("Check database file permissions.\n\n Example:\n lore doctor")
|
||||
}
|
||||
}
|
||||
Self::Http(_) => Some("Check network connection"),
|
||||
Self::NotFound(_) => {
|
||||
Some("Verify the entity exists.\n\n Example:\n lore issues\n lore mrs")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user