exo_consensus/error.rs
1// Copyright 2026 Exochain Foundation
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// https://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#[derive(Error, Debug)]
20pub enum ConsensusError {
21 #[error("Round limit exceeded")]
22 RoundLimitExceeded,
23
24 #[error("Commitment mismatch for model {model_id}")]
25 CommitmentMismatch { model_id: String },
26
27 #[error("Model {model_id} not found in panel")]
28 ModelNotFound { model_id: String },
29
30 #[error("LLM Provider error: {0}")]
31 ProviderError(String),
32
33 #[error("Invalid panel configuration: {0}")]
34 InvalidPanel(String),
35
36 #[error("State error: {0}")]
37 StateError(String),
38
39 #[error("Hash serialization failed for {context}: {source}")]
40 HashSerialization {
41 context: &'static str,
42 source: exo_core::error::ExoError,
43 },
44}
45
46pub type Result<T> = std::result::Result<T, ConsensusError>;