error_kit/
constructors.rs1use std::io::Error as IoError;
2
3use super::types::CommonError;
4
5impl CommonError {
6 pub fn io_error(message: &str) -> Self {
8 CommonError::Io(IoError::other(message))
9 }
10
11 pub fn cache_lock() -> Self {
13 CommonError::CacheLock
14 }
15
16 pub fn serialization(detail: &'static str) -> Self {
18 CommonError::Serialization(detail)
19 }
20
21 pub fn deserialization(detail: &'static str) -> Self {
23 CommonError::Deserialization(detail)
24 }
25
26 pub fn unsupported_file_type(detail: &'static str) -> Self {
28 CommonError::UnsupportedFileType(detail)
29 }
30
31 pub fn data_not_found() -> Self {
33 CommonError::DataNotFound
34 }
35
36 pub fn unable_to_fresh_data() -> Self {
38 CommonError::UnableToFreshData
39 }
40
41 pub fn stale_internal_none() -> Self {
43 CommonError::StaleInternalNone
44 }
45
46 pub fn timeout() -> Self {
48 CommonError::Timeout
49 }
50
51 pub fn filename_error() -> Self {
53 CommonError::FilenameError
54 }
55
56 pub fn invalid_filename_encoding() -> Self {
58 CommonError::InvalidFilenameEncoding
59 }
60
61 pub fn missing_timestamp_separator() -> Self {
63 CommonError::MissingTimestampSeparator
64 }
65
66 pub fn missing_file_extension() -> Self {
68 CommonError::MissingFileExtension
69 }
70
71 pub fn timestamp_parse_error() -> Self {
73 CommonError::TimestampParseError
74 }
75}