File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
rust/cardano-blockchain-types Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -38,3 +38,4 @@ num-traits = "0.2.19"
3838ed25519-dalek = " 2.1.1"
3939serde = " 1.0.210"
4040num-bigint = " 0.4.6"
41+ serde_json = " 1.0.134"
Original file line number Diff line number Diff line change @@ -4,8 +4,7 @@ pub mod key_registration;
44pub mod registration_witness;
55mod validation;
66pub mod voting_pk;
7-
8- use std:: collections:: HashMap ;
7+ use std:: { collections:: HashMap , fmt} ;
98
109use catalyst_types:: problem_report:: ProblemReport ;
1110use ed25519_dalek:: VerifyingKey ;
@@ -54,6 +53,19 @@ pub struct Cip36Error {
5453 report : ProblemReport ,
5554}
5655
56+ impl fmt:: Display for Cip36Error {
57+ fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
58+ let report_json = serde_json:: to_string ( & self . report )
59+ . unwrap_or_else ( |_| String :: from ( "Failed to serialize ProblemReport" ) ) ;
60+
61+ write ! (
62+ fmt,
63+ "Cip36Error {{ error: {}, report: {} }}" ,
64+ self . error, report_json
65+ )
66+ }
67+ }
68+
5769impl Cip36 {
5870 /// Create an instance of CIP-36.
5971 /// The CIP-36 registration contains the key registration (61284)
You can’t perform that action at this time.
0 commit comments