Skip to content

simc: error: refactor generic String to error types#325

Merged
apoelstra merged 5 commits into
BlockstreamResearch:masterfrom
gerau:simc/errors-refactor-string-to-types
May 21, 2026
Merged

simc: error: refactor generic String to error types#325
apoelstra merged 5 commits into
BlockstreamResearch:masterfrom
gerau:simc/errors-refactor-string-to-types

Conversation

@gerau
Copy link
Copy Markdown
Contributor

@gerau gerau commented May 18, 2026

For motivation see #324 (comment).

gerau added 5 commits May 18, 2026 15:46
In order to wrap the error inside, we need to get rid of these because
not all of them implement this. It seems like it was used only in the
`UseDecl` hash implementation.
@gerau gerau requested a review from delta1 as a code owner May 18, 2026 13:48
@KyrylR
Copy link
Copy Markdown
Collaborator

KyrylR commented May 20, 2026

Is it expected that let x: u8 = 999 now reports Integer parsing error, losing the previous number too large to fit in target type detail?

@gerau
Copy link
Copy Markdown
Contributor Author

gerau commented May 20, 2026

I've based my changes on this comment: #324 (comment), and if IIUC, this is pretty much expected. I would be happy to change it if you want.

Copy link
Copy Markdown
Collaborator

@KyrylR KyrylR left a comment

Choose a reason for hiding this comment

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

ACK 1448898; successfully ran local tests

@apoelstra
Copy link
Copy Markdown
Contributor

Is it expected that let x: u8 = 999 now reports Integer parsing error, losing the previous number too large to fit in target type detail?

Our reports should use Error::source to provide the full stack of error details, similar to how anyhow outputs errors. The other method, of manually pasting strings together in the errors' Display impls so that you can one-shot fmt the whole error stack, is (at best) inflexible since it prevents us reformatting stuff, and at worst loses information because 3rd-party errors will expect us to call source to get inner errors.

I also don't think "everything in fmt" it will survive the transition to multi-line errors.

@apoelstra
Copy link
Copy Markdown
Contributor

In 6a5099d:

You need to impl the source method for Error.

@apoelstra
Copy link
Copy Markdown
Contributor

Oh, never mind, this is done in 1448898

Copy link
Copy Markdown
Contributor

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 1448898; successfully ran local tests

@apoelstra apoelstra merged commit 0779894 into BlockstreamResearch:master May 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants