dpp/errors/consensus/signature/
basic_ecdsa_error.rs1use crate::consensus::signature::signature_error::SignatureError;
2use crate::consensus::ConsensusError;
3use crate::errors::ProtocolError;
4use platform_serialization_derive::{
5 PlatformDeserializeTrusted, PlatformDeserializeUntrusted, PlatformSerialize,
6};
7use thiserror::Error;
8
9use bincode::{Decode, DecodeUntrusted, Encode};
10
11#[derive(
12 Error,
13 Debug,
14 Clone,
15 PartialEq,
16 Eq,
17 Default,
18 Encode,
19 Decode,
20 PlatformSerialize,
21 PlatformDeserializeTrusted,
22 PlatformDeserializeUntrusted,
23 DecodeUntrusted,
24)]
25#[error("ecdsa signing error {message}")]
26#[platform_serialize(unversioned)]
27pub struct BasicECDSAError {
28 message: String,
29}
30
31impl BasicECDSAError {
38 pub fn new(message: String) -> Self {
39 Self { message }
40 }
41}
42
43impl From<BasicECDSAError> for ConsensusError {
44 fn from(err: BasicECDSAError) -> Self {
45 Self::SignatureError(SignatureError::BasicECDSAError(err))
46 }
47}