Download src/utils/error.rs from sanbo1200/ct: direct link, hf CLI and curl.
- Browser
- Download file 1.9 kB
-
https://huggingface.co/spaces/sanbo1200/ct/resolve/main/src/utils/error.rs
- Command line
-
hf download hf://spaces/sanbo1200/ct/src/utils/error.rs
-
curl -L -o error.rs https://huggingface.co/spaces/sanbo1200/ct/resolve/main/src/utils/error.rs
1.9 kB
| use thiserror::Error; | |
| /// ChatGPT client errors | |
| pub enum ChatGptError { | |
| Network( reqwest::Error), | |
| Json( serde_json::Error), | |
| Base64Decode( base64::DecodeError), | |
| Io( std::io::Error), | |
| Image( image::ImageError), | |
| InvalidProxy(String), | |
| ChallengeSolve(String), | |
| VmExecution(String), | |
| IpFlagged, | |
| Authentication(String), | |
| InvalidResponse(String), | |
| Configuration(String), | |
| Unknown(String), | |
| } | |
| /// Result type alias for ChatGPT operations | |
| pub type Result<T> = std::result::Result<T, ChatGptError>; | |
| impl ChatGptError { | |
| pub fn invalid_proxy(msg: impl Into<String>) -> Self { | |
| Self::InvalidProxy(msg.into()) | |
| } | |
| pub fn challenge_solve(msg: impl Into<String>) -> Self { | |
| Self::ChallengeSolve(msg.into()) | |
| } | |
| pub fn vm_execution(msg: impl Into<String>) -> Self { | |
| Self::VmExecution(msg.into()) | |
| } | |
| pub fn authentication(msg: impl Into<String>) -> Self { | |
| Self::Authentication(msg.into()) | |
| } | |
| pub fn invalid_response(msg: impl Into<String>) -> Self { | |
| Self::InvalidResponse(msg.into()) | |
| } | |
| pub fn configuration(msg: impl Into<String>) -> Self { | |
| Self::Configuration(msg.into()) | |
| } | |
| pub fn unknown(msg: impl Into<String>) -> Self { | |
| Self::Unknown(msg.into()) | |
| } | |
| } | |