Actions
Bug #23241
openWindows directives should catch exception at runtime
Pull Request:
Severity:
Minor - inconvenience | misleading | easy workaround
UX impact:
I dislike using that feature
User visibility:
Operational - other Techniques | Rudder settings | Plugins
Effort required:
Very Small
Priority:
72
Name check:
To do
Fix check:
To do
Regression:
No
Description
If for some reasons the directive call fails, the error is uncatched and just displayed in the output.
I have no idea on what to do with the exception yet, but it should be catched and logged.
The change should be easy to do at the generation process level by modifying the "RUDDER_DIRECTIVES_SEQUENCE" from:
BeginDirectiveCall -Name 'Windows/Test windows' -Id 'b8fdadd6-eda6-4d2c-9fcf-829ee5c5d8b5' TestWindows -ReportId '0bfbf8af-89dc-4c67-805a-07c9c416aed0@@b8fdadd6-eda6-4d2c-9fcf-829ee5c5d8b5@@0' -TechniqueName 'test_windows' -PolicyMode ([Rudder.PolicyMode]::Enforce) EndDirectiveCall -Name 'Windows/Test windows' -Id 'b8fdadd6-eda6-4d2c-9fcf-829ee5c5d8b5'
to something like:
BeginDirectiveCall -Name 'Windows/Test windows' -Id 'b8fdadd6-eda6-4d2c-9fcf-829ee5c5d8b5' try { TestWindows -ReportId '0bfbf8af-89dc-4c67-805a-07c9c416aed0@@b8fdadd6-eda6-4d2c-9fcf-829ee5c5d8b5@@0' -TechniqueName 'test_windows' -PolicyMode ([Rudder.PolicyMode]::Enforce) } catch { [Rudder.Logger]::Log.Error( ([String]::Format( 'Directive "{0}" encountered an unexpected failure, see the error below:{1}{2}', '0bfbf8af-89dc-4c67-805a-07c9c416aed0@@b8fdadd6-eda6-4d2c-9fcf-829ee5c5d8b5@@0', "`n", (Format-Exception $_)[1] )) ) } EndDirectiveCall -Name 'Windows/Test windows' -Id 'b8fdadd6-eda6-4d2c-9fcf-829ee5c5d8b5'
Actions