Comments (3)
Implementation ideas:
- Rewrite the
.ScriptStackTrace
property with a string that omits a bunch of the stack trace. - Catch the exception at lowest point in the call stack that is inside ZeroDSC, and somehow re-throw that same exception at the highest point in the call stack.
- Change the way
[ConfigStep]
objects are set up such that the call stack betweenInvoke-ConfigStep
and the underlying resource is minimized.
from zerodsc.
(1) is complicated by .ScriptStackTrace
being a read-only property.
try
{
throw
}
catch
{
$_.ScriptStackTrace = 'new trace'
}
results in
'ScriptStackTrace' is a ReadOnly property.
At C:\Users\un1\Desktop\test.ps1:7 char:5
+ $_.ScriptStackTrace = 'new trace'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
from zerodsc.
It doesn't seem like (2) would work because .ScriptStackTrace
is populated when the exception is first thrown. So catching and re-throwing doesn't change its contents. For example,
function f1 { throw 'exception in f1' }
function f2 { try { f1 } catch { return $_ } }
function f3 { $e = f2; return $e }
function f4 { $e = f3; throw $e }
Describe 'delayed re-throw' {
It 'test' {
f4
}
}
results in
Describing delayed re-throw
[-] test 18ms
RuntimeException: exception in f1
at f1, C:\Users\un1\Desktop\test.ps1: line 1
at f2, C:\Users\un1\Desktop\test.ps1: line 2
at f3, C:\Users\un1\Desktop\test.ps1: line 3
at f4, C:\Users\un1\Desktop\test.ps1: line 4
at <ScriptBlock>, C:\Users\un1\Desktop\test.ps1: line 8
from zerodsc.
Related Issues (20)
- Importing Multiple Versions of the Same DSC Resource should be Tested
- Invoking ConfigInstruction in two different runspaces cases ExceptionInGetEnumerator
- ConfigInstructions should throw an exception when DependsOn points to itself
- ConfigInstructions should throw an exception when a DependsOn points to a non-existent resource
- ConfigInstructions should include location of offending line in exception for duplicate resources
- Mention Prerequisites in "Installing ZeroDSC" Section
- Recommend using latest release
- The public API should have comment-based help
- Earlier testing of parameter compatibility HOT 1
- A resource invocation that throws an exception can cause endless loop. HOT 1
- Should ZeroDSC export `Import-DscResource`?
- InModuleScope{} should be used instead of a module argument HOT 2
- The Resource Invokers topic should not be part of the introductory section
- Test-MofResourceType Inadvertently Unloads Module HOT 1
- The code snippets in Docs should be syntax-highlighted HOT 1
- The presense of multiple versions of the same DSC resources should be tolerated HOT 1
- Stacktrace should include resource files when a resource throws an exception HOT 3
- Add the AppVeyor badge
- AppVeyor should skip commits to documentation files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zerodsc.