dsntk 0.3.0

ÐecisionToolkit | Design and execute decisions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! # Error definitions

use dsntk_common::{DsntkError, ToErrorMessage};

/// Command-line action error.
#[derive(ToErrorMessage)]
struct ActionError(String);

/// Error related to creating directory.
pub fn err_create_directory(path: &str, reason: &str) -> DsntkError {
  ActionError(format!("creating directory '{path}' failed with reason: {reason}")).into()
}

/// Error related to saving a file.
pub fn err_save_file(path: &str, reason: &str) -> DsntkError {
  ActionError(format!("saving file '{path}' failed with reason: {reason}")).into()
}