Skip to main content

consortium_data/
error.rs

1// Copyright 2026 Ethan Wu
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.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// SPDX-License-Identifier: Apache-2.0
16
17use thiserror::Error;
18
19/// Errors raised while resolving and parsing the bundled chip data.
20#[derive(Error, Debug, PartialEq, Eq, Clone, Hash)]
21pub enum DataError {
22    #[error("no chip-family database matches chip '{0}'")]
23    UnknownChip(String),
24
25    #[error("no device-tree source matches '{0}'")]
26    UnknownDts(String),
27
28    #[error("failed to parse chip database for '{0}': {1}")]
29    DatabaseParse(String, String),
30
31    #[error("no peripheral/interrupt map is bundled for chip '{chip}' core '{core}'")]
32    ChipMapUnavailable { chip: String, core: String },
33
34    #[error("failed to parse the peripheral map for chip '{chip}' core '{core}': {detail}")]
35    ChipMapParse {
36        chip: String,
37        core: String,
38        detail: String,
39    },
40}