File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
77# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88
99[dependencies ]
10+ thiserror = " 1.0.24"
Original file line number Diff line number Diff line change 1+ use thiserror:: Error ;
2+
3+ /// [`Result`](std::result::Result) type that is returned from functions with error
4+ /// as [`TypesenseError`](crate::error::TypesenseError).
5+ pub type Result < T > = std:: result:: Result < T , TypesenseError > ;
6+
7+ /// Represents an error that can occur while using the library.
8+ #[ derive( Error , Debug ) ]
9+ pub enum TypesenseError {
10+ /// Config error.
11+ #[ error( "config error" ) ]
12+ ConfigError ,
13+
14+ /// Timeout.
15+ #[ error( "timeout" ) ]
16+ Timeout ,
17+
18+ /// Request malformed.
19+ #[ error( "request malformed" ) ]
20+ RequestMalformed ,
21+
22+ /// Request unauthorized.
23+ #[ error( "request unauthorized" ) ]
24+ RequestUnauthorized ,
25+
26+ /// Request forbidden.
27+ #[ error( "request forbidden" ) ]
28+ RequestForbidden ,
29+
30+ /// Object not found.
31+ #[ error( "object not found" ) ]
32+ ObjectNotFound ,
33+
34+ /// Object already exists.
35+ #[ error( "object already exists" ) ]
36+ ObjectAlreadyExists ,
37+
38+ /// Object unprocessable.
39+ #[ error( "object unprocessable" ) ]
40+ ObjectUnprocessable ,
41+
42+ /// Server error.
43+ #[ error( "server error" ) ]
44+ ServerError ,
45+
46+ /// Service unavailable.
47+ #[ error( "service unavailable" ) ]
48+ ServiceUnavailable ,
49+
50+ /// HTTP status error.
51+ #[ error( "HTTP status error" ) ]
52+ HttpStatusError ,
53+ }
Original file line number Diff line number Diff line change 22//! # Typesense
33//!
44//! Welcome to typesense, the rust library for the Typesense API.
5+
6+ mod error;
7+
8+ pub use error:: { Result , TypesenseError } ;
You can’t perform that action at this time.
0 commit comments