-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix trap handling when running components #382
Conversation
9dd8d53
to
3b35f22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except for weird stray braces
|
||
trappable_error_type: { | ||
"fastly:api/types/error" => types::TrappableError, | ||
}, | ||
|
||
trappable_imports: [ | ||
"header-values-get" | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little funky that these types will be different even in the non-trapping config, but I think this probably the lightest touch possible for making the two modes work out (vs duplicating the macro invocation entirely between both configs... ugh)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also makes it so that we don't have to deal with nested Result
values in the return type for header-values-get
, which is much easier for me to think about 😅
1459351
to
5bde097
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🪤
The component implementation didn't have support for either the test-fatalerror-config feature, or the ability to treat the Error::FatalError variant as a trap. This PR fixes that by doing the following: * Allowing header_values_get to trap based on the test-fatalerror-config feature * Introducing the TrappableError type for treating FatalError as a trap * Adding a variant of the trap-test that uses the component adapter The remaining difference to the wiggle implementation is that only functions listed in trappable_errors will be able to emit traps for FatalError, though the only case we currently use that in is for test-fatalerror-config, so it seemed reasonable to not switch everything to TrappableError.
The component implementation didn't have support for either the
test-fatalerror-config
feature, or the ability to treat theError::FatalError
variant as a trap. This PR fixes that by doing the following:header_values_get
to trap based on thetest-fatalerror-config
featureTrappableError
type for treatingFatalError
as a traptrap-test
that uses the component adapterThe remaining difference to the wiggle implementation is that only functions listed in
trappable_errors
will be able to emit traps forFatalError
, though the only case we currently use that in is fortest-fatalerror-config
, so it seemed reasonable to not switch everything toTrappableError
.