pub struct TheError {
pub error: TheErrorType,
pub file: Option<String>,
pub location: Option<(u32, u32)>,
pub datestamp: Option<NaiveDate>,
pub timestamp: Option<NaiveTime>,
}Expand description
Struct that contains the error itself mapped within a TheErrorType struct, with its error content configured in the origin crate, the file, location, datestamp and timestamp data of when the error was remapped using the map_to_new_error! macro.
Fields§
§error: TheErrorType§file: Option<String>§location: Option<(u32, u32)>§datestamp: Option<NaiveDate>§timestamp: Option<NaiveTime>Implementations§
Source§impl TheError
impl TheError
Sourcepub fn new(error_type: SystemErrorCodes, error_content: String) -> Self
pub fn new(error_type: SystemErrorCodes, error_content: String) -> Self
Description: Creates a new error of TheError type, receiving as parameters the error type and content, and capturing the file, location, datestamp and timestamp info
Sourcepub fn get_type(&self) -> &SystemErrorCodes
pub fn get_type(&self) -> &SystemErrorCodes
Returns the SystemErrorCode associated with this error
Sourcepub fn get_content(&self) -> &String
pub fn get_content(&self) -> &String
Returns the error content mapped from the origin error
Sourcepub fn get_location_info(&self) -> &Option<(u32, u32)>
pub fn get_location_info(&self) -> &Option<(u32, u32)>
Returns the location String in file-line-column format
Sourcepub fn get_datestamp(&self) -> &Option<NaiveDate>
pub fn get_datestamp(&self) -> &Option<NaiveDate>
Returns the error’s NaiveDate datestamp as a String
Sourcepub fn get_timestamp(&self) -> &Option<NaiveTime>
pub fn get_timestamp(&self) -> &Option<NaiveTime>
Returns the error’s NaiveTime timestamp as a String
Sourcepub fn get_datetime(&self) -> Option<(String, String)>
pub fn get_datetime(&self) -> Option<(String, String)>
Returns the error’s datetime stamp as a String
Sourcepub fn with_type(self, error_type: SystemErrorCodes) -> Self
pub fn with_type(self, error_type: SystemErrorCodes) -> Self
Description: Adds the error type to the error
Sourcepub fn with_content(self, error_content: String) -> Self
pub fn with_content(self, error_content: String) -> Self
Description: Adds the error content to the error
Sourcepub fn with_file_data(self, file: String) -> Self
pub fn with_file_data(self, file: String) -> Self
Description: Adds the file data to the error
Sourcepub fn with_location_data(self, location: (u32, u32)) -> Self
pub fn with_location_data(self, location: (u32, u32)) -> Self
Description: Adds the location data to the error
Sourcepub fn with_datestamp_data(self, datestamp: NaiveDate) -> Self
pub fn with_datestamp_data(self, datestamp: NaiveDate) -> Self
Description: Adds the datestamp data to the error
Sourcepub fn with_timestamp_data(self, timestamp: NaiveTime) -> Self
pub fn with_timestamp_data(self, timestamp: NaiveTime) -> Self
Description: Adds the timestamp data to the error
Sourcepub fn add_error_type(&mut self, error_type: SystemErrorCodes)
pub fn add_error_type(&mut self, error_type: SystemErrorCodes)
Description: Allows the user to add the error type after creation
Sourcepub fn add_error_content(&mut self, content: String)
pub fn add_error_content(&mut self, content: String)
Description: Allows the user to add the error content after creation
Sourcepub fn add_file_data(&mut self, file: String)
pub fn add_file_data(&mut self, file: String)
Description: Allows the user to add the file data after creation
Sourcepub fn add_location_data(&mut self, location: (u32, u32))
pub fn add_location_data(&mut self, location: (u32, u32))
Description: Allows the user to add the location data after creation
Sourcepub fn add_datestamp_data(&mut self, datestamp: NaiveDate)
pub fn add_datestamp_data(&mut self, datestamp: NaiveDate)
Description: Allows the user to add the datestamp data after creation
Sourcepub fn add_timestamp_data(&mut self, timestamp: NaiveTime)
pub fn add_timestamp_data(&mut self, timestamp: NaiveTime)
Description: Allows the user to add the timestamp data after creation