Description
Describe the Feature
ErrorActionPreference Continue results in the last object being returned to the caller.
ErrorActionPreference should work as you would expect if you ran your script outside of lambda. If ErrorActionPreference is set to Continue, the script should continue to execute and return the last object, not the error.
Is your Feature Request related to a problem?
Module functions that write errors have to be suppressed using ErrorAction SilentlyContinue to prevent lambda from "giving up" on returning the last object.
Proposed Solution
Describe alternatives you've considered
Additional Context
The default ErrorActionPreference in lambda is Continue however lambda is weird and it will hold on to an error and give it to the caller rather than return the last object.
It does not "throw" or "return" the error (i.e. stop execution) as you would expect in reading the documentation. The script will continue to run regardless of the error. If a script has side effects that occur after the error (like Write-S3Object) they will run.
This can mislead developers into thinking their code stopped (since they got some error early on in the script), but in reality the script continued to execute after the error.
Environment
- 👋 I may be able to implement this feature request
-
⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request