add diagnostic string to DecodeFailed

This commit is contained in:
Ken Sedgwick
2025-02-20 11:13:32 -08:00
parent d82d7fd00d
commit d39b2706e0
3 changed files with 6 additions and 5 deletions

View File

@@ -225,7 +225,6 @@ fn calculate_ws_message_size(message: &WsMessage) -> usize {
fn calculate_error_size(error: &Error) -> usize {
match error {
Error::Empty
| Error::DecodeFailed
| Error::HexDecodeFailed
| Error::InvalidBech32
| Error::InvalidByteSize
@@ -233,6 +232,8 @@ fn calculate_error_size(error: &Error) -> usize {
| Error::Io(_)
| Error::InvalidPublicKey => mem::size_of_val(error), // No heap usage
Error::DecodeFailed(string) => mem::size_of_val(error) + string.len(),
Error::Json(json_err) => mem::size_of_val(error) + json_err.to_string().len(),
Error::Nostrdb(nostrdb_err) => mem::size_of_val(error) + nostrdb_err.to_string().len(),