use std::error::Error;
use std::fmt;
use std::rc::Rc;
#[derive(Clone, Debug)]
pub struct RenderTargetCorruptedException {
message: Option<String>,
inner_exception: Option<Rc<dyn Error>>,
}
impl RenderTargetCorruptedException {
pub fn new() -> Self {
Self { message: None, inner_exception: None }
}
pub fn new_with_message(message: impl Into<String>) -> Self {
Self { message: Some(message.into()), inner_exception: None }
}
pub fn new_with_inner_exception(inner_exception: Rc<dyn Error>) -> Self {
Self { message: None, inner_exception: Some(inner_exception) }
}
pub fn new_with_message_and_inner_exception(message: impl Into<String>, inner_exception: Rc<dyn Error>) -> Self {
Self { message: Some(message.into()), inner_exception: Some(inner_exception) }
}
pub fn message(&self) -> &str {
self.message.as_deref().unwrap_or("Exception of type 'FerroUI.RenderTargetCorruptedException' was thrown.")
}
pub fn inner_exception(&self) -> Option<&Rc<dyn Error>> {
self.inner_exception.as_ref()
}
}
impl Default for RenderTargetCorruptedException {
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for RenderTargetCorruptedException {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.message())
}
}
impl Error for RenderTargetCorruptedException {
fn source(&self) -> Option<&(dyn Error + 'static)> {
self.inner_exception.as_deref()
}
}