Skip to content

Commit

Permalink
Make errors non_exhaustive (#1542)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez authored Oct 31, 2023
1 parent 8865fa0 commit 36375de
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions bindings/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub type Result<T> = std::result::Result<T, Error>;

/// Error type for the bindings core crate.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Block errors.
#[error("{0}")]
Expand Down
1 change: 1 addition & 0 deletions cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use rustyline::error::ReadlineError;
use serde_json::Error as SerdeJsonError;

#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("block error: {0}")]
Block(#[from] BlockError),
Expand Down
1 change: 1 addition & 0 deletions sdk/src/client/api/block_builder/input_selection/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::types::block::output::{ChainId, OutputId, TokenId};

/// Errors related to input selection.
#[derive(Debug, Eq, PartialEq, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Block error.
#[error("{0}")]
Expand Down
1 change: 1 addition & 0 deletions sdk/src/client/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub type Result<T> = std::result::Result<T, Error>;

/// Error type of the iota client crate.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Invalid bech32 HRP, should match the one from the used network
#[error("invalid bech32 hrp for the connected network: {provided}, expected: {expected}")]
Expand Down
1 change: 1 addition & 0 deletions sdk/src/client/node_api/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub type Result<T> = std::result::Result<T, Error>;

/// Node errors.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// The requested data was not found. (404)
#[error("The requested data {0} was not found.")]
Expand Down
1 change: 1 addition & 0 deletions sdk/src/client/node_api/mqtt/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

/// MQTT related errors.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Client error.
#[error("client error {0}")]
Expand Down
1 change: 1 addition & 0 deletions sdk/src/client/secret/ledger_nano.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use crate::{

/// Ledger nano errors.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Denied by User
#[error("denied by user")]
Expand Down
1 change: 1 addition & 0 deletions sdk/src/client/stronghold/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

/// Stronghold errors.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Crypto.rs error
#[error("{0}")]
Expand Down
1 change: 1 addition & 0 deletions sdk/src/types/api/plugins/participation/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#[derive(Debug)]
#[non_exhaustive]
pub enum Error {
/// Invalid participations error
InvalidParticipations,
Expand Down
1 change: 1 addition & 0 deletions sdk/src/types/block/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use crate::types::block::{
/// Error occurring when creating/parsing/validating blocks.
#[derive(Debug, PartialEq, Eq)]
#[allow(missing_docs)]
#[non_exhaustive]
pub enum Error {
ManaAllotmentsNotUniqueSorted,
ConsumedAmountOverflow,
Expand Down
1 change: 1 addition & 0 deletions sdk/src/wallet/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::types::block::{address::Bech32Address, payload::signed_transaction::T

/// The wallet error type.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Account alias must be unique.
#[error("can't create account: account alias {0} already exists")]
Expand Down

0 comments on commit 36375de

Please sign in to comment.