throw "some message"
catch {
access thrown text how exactly?
}
Not a complicated thing - pretty straight forward everywhere you see try / catch / throw - but not for MS. On the page that claims to give all the answers this one small commonly used detail is omitted. I grant it may be embedded somewhere in the text - but it is the age old gripe - make me read pages and pages of text to find that one small thing I need which is not that an uncommon request.
A simple
try {
throw "Oops"
} catch {
Write-Host $Error[0]
}
Would have cleared this up nicely - but not a mention of it on the page - but this is the page that tells us EVERYTHING we need to know about try / catch / throw
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
throw "some message"
catch {
access thrown text how exactly?
}
Not a complicated thing - pretty straight forward everywhere you see try / catch / throw - but not for MS. On the page that claims to give all the answers this one small commonly used detail is omitted. I grant it may be embedded somewhere in the text - but it is the age old gripe - make me read pages and pages of text to find that one small thing I need which is not that an uncommon request.
A simple
try {
throw "Oops"
} catch {
Write-Host $Error[0]
}
Would have cleared this up nicely - but not a mention of it on the page - but this is the page that tells us EVERYTHING we need to know about try / catch / throw
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.