Skip to content

Conversation

@knopers8
Copy link
Collaborator

Fixing an issue caused by the fact that I have no idea what I'm doing in Go. fsm.InvalidEventError implements Error() with a value receiver, which actually allows to provide an error as a value or as a pointer. However, errors.As() is not smart about it and does not strip the type from references/pointers/etc, so the original version would work only with errors passed as pointers.

This commit modifies the helper to work correctly with errors provided as values, which is the more natural way to use it. Unfortunately it is not possible to prevent a caller from passing an error pointer.

Let's consider it as a part of OCTRL-1064.

Fixing an issue caused by the fact that I have no idea what I'm doing in Go.
fsm.InvalidEventError implements Error() with a value receiver, which actually allows to provide an error as a value or as a pointer.
However, errors.As() is not smart about it and does not strip the type from references/pointers/etc, so the original version would work only with errors passed as pointers.

This commit modifies the helper to work correctly with errors provided as values, which is the more natural way to use it.
Unfortunately it is not possible to prevent a caller from passing an error pointer.

Let's consider it as a part of OCTRL-1064.
@knopers8 knopers8 requested a review from justonedev1 as a code owner October 31, 2025 09:10
@knopers8 knopers8 merged commit a3fd1f2 into AliceO2Group:master Oct 31, 2025
3 checks passed
@knopers8 knopers8 deleted the fix-failed-go-error branch October 31, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants