Single trap definition for all tasks? #246
Replies: 1 comment 1 reply
I do not think such trap will be possible. But the error enhancement you show is doable now. In Exit-Bulld use the build variable * - it's property Error if not null is the error that failed the build. |
Uh oh!
There was an error while loading. Please reload this page.
Hi everybody,
we usually use the following trap definition to get useful info about errors such as stack traces:
For the .build.ps1 we can't yet get it to work properly, which I guess is caused by the way Invoke-Build works (which I don't know yet) in combination with how traps are designed: PowerShell/PowerShell#25742
However, I wonder if there is any workaround or alternative?
Imagine the following example:
When invoking task1 or task2, the
foocommands produce errors, but I don't yet get the stack trace. I can get it by inserting the trap definition into each task. For our actual project with almost 30 tasks, this would result in a lot of code duplication though, so we are looking for a solution with minimal code duplication.I already tried using
Enter-Build,Enter-BuildTaskandEnter-BuildJob, but with no success.I wonder if anybody has ideas on how to get it to work by a single definition or by a alternative?
Cheers!
All reactions