Skip to content

feat: add stacktrace to SSZ#1017

Merged
avilagaston9 merged 12 commits intomainfrom
ssz-stacktrace
Apr 24, 2024
Merged

feat: add stacktrace to SSZ#1017
avilagaston9 merged 12 commits intomainfrom
ssz-stacktrace

Conversation

@avilagaston9
Copy link
Copy Markdown
Contributor

@avilagaston9 avilagaston9 commented Apr 22, 2024

This PR adds a stacktrace to the Error struct in SSZ.

image

Closes #1004

@avilagaston9 avilagaston9 marked this pull request as ready for review April 23, 2024 14:38
@avilagaston9 avilagaston9 requested a review from a team as a code owner April 23, 2024 14:38
{:error, error} = SszEx.hash_tree_root(execution_payload)

assert "#{error}" ==
"Invalid binary length while merkleizing byte_vector.\nExpected size: 256.\nFound: 3\nStacktrace: Elixir.Types.ExecutionPayload.logs_bloom"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we normalize types so that it says ExecutionPayload.logs_bloom instead of Elixir.Types.ExecutionPayload.logs_bloom?


def add_trace(%Error{message: message, stacktrace: stacktrace}, value) when is_struct(value) do
new_trace =
value.__struct__ |> Module.split() |> List.last()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@avilagaston9 avilagaston9 merged commit 7a7b5a9 into main Apr 24, 2024
@avilagaston9 avilagaston9 deleted the ssz-stacktrace branch April 24, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Add a stack trace in SSZ errors

3 participants