keramics_sigscan/errors.rs
1/* Copyright 2024-2025 Joachim Metz <joachim.metz@gmail.com>
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may
5 * obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 * License for the specific language governing permissions and limitations
11 * under the License.
12 */
13
14use std::error::Error;
15use std::fmt;
16
17/// The error returned for issues while building a scan tree.
18#[derive(Debug)]
19pub struct BuildError {
20 /// The error message.
21 message: String,
22}
23
24impl BuildError {
25 /// Creates a new error.
26 pub fn new(message_string: String) -> Self {
27 Self {
28 message: message_string,
29 }
30 }
31}
32
33impl Error for BuildError {}
34
35impl fmt::Display for BuildError {
36 /// Formats the error for display.
37 fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
38 write!(formatter, "{}", self.message)
39 }
40}