Skip to content

Commit eca0e76

Browse files
authored
renderer-rust: add decode-error trait to errors (#380)
* renderer-rust: add decode-error trait to errors * add changeset
1 parent a229fbe commit eca0e76

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

.changeset/rich-nails-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codama/renderers-rust': patch
3+
---
4+
5+
add decode-error trait to errors

packages/renderers-rust/e2e/system/src/generated/errors/system.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ impl solana_program::program_error::PrintProgramError for SystemError {
4444
solana_program::msg!(&self.to_string());
4545
}
4646
}
47+
48+
impl<T> solana_program::decode_error::DecodeError<T> for SystemError {
49+
fn type_of() -> &'static str {
50+
"SystemError"
51+
}
52+
}

packages/renderers-rust/public/templates/errorsPage.njk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ impl solana_program::program_error::PrintProgramError for {{ program.name | pasc
2020
}
2121
}
2222

23+
impl<T> solana_program::decode_error::DecodeError<T> for {{ program.name | pascalCase }}Error {
24+
fn type_of() -> &'static str {
25+
"{{ program.name | pascalCase }}Error"
26+
}
27+
}
28+
2329
{% endblock %}

0 commit comments

Comments
 (0)