rsgt 0.3.0

Rust simple GUI Toolkit
//! # Error handling

use crate::msgbox::{MsgBox, BS_OK, MS_ERROR};
use crate::os::enable_visual_style;

pub struct Error {
    /// Error message
    message: String,
}

impl Error {
    /// Initialize error
    pub(crate) fn new(message: impl Into<String>) -> Self {
        enable_visual_style();
        Self {
            message: message.into(),
        }
    }

    /// Show error message box
    pub(crate) fn error(self) {
        MsgBox::new(self.message, "Error", MS_ERROR, BS_OK).run();
    }
}