manabrew_engine/ability/
illegal_ability_exception.rs1use std::fmt;
6
7#[derive(Debug, Clone)]
9pub struct IllegalAbilityException {
10 pub message: String,
11}
12
13impl IllegalAbilityException {
14 pub fn new(message: impl Into<String>) -> Self {
16 Self {
17 message: message.into(),
18 }
19 }
20
21 pub fn with_effect(sa_desc: &str, effect_name: &str) -> Self {
23 Self {
24 message: format!("{sa_desc} (effect {effect_name})"),
25 }
26 }
27}
28
29impl fmt::Display for IllegalAbilityException {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 write!(f, "IllegalAbilityException: {}", self.message)
32 }
33}
34
35impl std::error::Error for IllegalAbilityException {}