Skip to content

Native Command Error Handling #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 55 commits into from
Closed
Changes from 15 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
bafe2b2
Added RFC Error View
theJasonHelmick Jul 31, 2019
bdd3ee9
update RFC error view
theJasonHelmick Jul 31, 2019
dd58c11
Added shorter reference code
theJasonHelmick Jul 31, 2019
d3ed694
update alternate view
theJasonHelmick Jul 31, 2019
5fd9c69
Added RFC Error View
theJasonHelmick Jul 31, 2019
3dd0560
update RFC error view
theJasonHelmick Jul 31, 2019
a7d6a75
Added shorter reference code
theJasonHelmick Jul 31, 2019
6faa7dc
update alternate view
theJasonHelmick Jul 31, 2019
c454366
updated comment due date on Error-View
theJasonHelmick Aug 7, 2019
fb60588
Update 1-Draft/RFC00XX-Update-Error-View.md
theJasonHelmick Aug 26, 2019
f4edfcd
review update for view name -simpleview
theJasonHelmick Aug 26, 2019
a6329e7
update to view name
theJasonHelmick Aug 26, 2019
0641bb2
fix unresolved merge conflict
theJasonHelmick Sep 3, 2019
8dabf42
Removed incorrect parameter -Oldest
theJasonHelmick Sep 3, 2019
35ed896
errorview-removed unneeded parameters
theJasonHelmick Sep 23, 2019
5cf273d
Errorview update to remove unneeded parameters
theJasonHelmick Sep 23, 2019
07af6d2
Changed view name from Concise to SimpleView
theJasonHelmick Sep 24, 2019
da03165
Added WriteErrorLine clarification
theJasonHelmick Sep 24, 2019
8cdd56a
Added example showing Inner exception
theJasonHelmick Sep 24, 2019
1bc65b1
Merge to my master
theJasonHelmick Sep 24, 2019
6de0c3e
updated normal and detailed view
theJasonHelmick Sep 24, 2019
697327c
added image of new error view
theJasonHelmick Sep 25, 2019
d6f6af4
Added image of errorview and adjusted carets
theJasonHelmick Sep 25, 2019
889cad4
Spelling correction
theJasonHelmick Sep 25, 2019
9439d35
Updated graphic display of error messages
theJasonHelmick Sep 25, 2019
51ec0f2
graphic update
theJasonHelmick Sep 25, 2019
1f272cd
edits to Overview
theJasonHelmick Sep 25, 2019
a58d4e8
update $errorview to enum
theJasonHelmick Sep 26, 2019
800f653
resolved conflict
theJasonHelmick Sep 26, 2019
ea14fcd
spelling corrections
theJasonHelmick Sep 26, 2019
46b2382
update for a new pr
theJasonHelmick Sep 26, 2019
b2f46ca
update to reflect view changes
theJasonHelmick Sep 30, 2019
0cef8c3
updated RFC Resolve-errorrecord definition
theJasonHelmick Oct 8, 2019
ec0b745
Corected typos
theJasonHelmick Oct 8, 2019
493a3a7
Updated RFC with Prefix conditions
theJasonHelmick Oct 8, 2019
8d0498e
update RFC to reflect new cmdlet name
theJasonHelmick Oct 15, 2019
34a3a62
updated RFC with Concise view as default view
theJasonHelmick Oct 21, 2019
3493c6b
Update RFC00XX-Update-Error-View.md
SteveL-MSFT Oct 23, 2019
04559ed
updated image to reflect cuurent code
theJasonHelmick Oct 24, 2019
eaecab0
update to reflect implementation
theJasonHelmick Jan 16, 2020
a97cbfe
update to match implementation - remove carets
theJasonHelmick Jan 16, 2020
0cfab18
update to correct readability flow
theJasonHelmick Jan 16, 2020
07807c7
update messageposition property information
theJasonHelmick Jan 16, 2020
e6cf938
Prep RFC0048 - Updated Error View for merging
joeyaiello Jan 29, 2020
20d1ed9
wip:NativeCommandErrorHandling
theJasonHelmick Sep 28, 2020
52579cb
Delete RFC0048-Update-Error-View.md
theJasonHelmick Oct 5, 2020
bb0a68d
Apply suggestions from code review
theJasonHelmick Oct 9, 2020
a53678c
Apply suggestions from code review
theJasonHelmick Oct 26, 2020
012e366
updated with PScommitee comments
theJasonHelmick Oct 26, 2020
821e898
updated with PSCommitee comments
theJasonHelmick Oct 27, 2020
8603d2b
Apply suggestions from code review
theJasonHelmick Oct 28, 2020
c7e1471
Committee suggestion updates
theJasonHelmick Oct 28, 2020
b9eb257
Committee suggestion updates
theJasonHelmick Oct 29, 2020
9642658
updated for PSCommittee
theJasonHelmick Nov 2, 2020
e46b595
updated for PSCommittee
theJasonHelmick Nov 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions 1-Draft/RFC00XX-Update-Error-View.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ containing the error will be displayed. A cmdlet will provide the full error de
The on-screen experience, when receiving an error message,
is controlled through the views NormalView (the default) and CategoryView. These are user selectable
through the preference variable $ErrorView.
<<<<<<< HEAD
The addition of a “ConciseView” as default that contains only specific error
=======
The addition of a “SimpleView” as default that contains only specific error
>>>>>>> Error-View
information producing a single line on screen and in logs will improve customer success.

Comprehensive error information is available to the customer through
Expand All @@ -30,23 +34,39 @@ improving customers success.

## Specification

<<<<<<< HEAD
The proposal is to add a new single-line default error message view called ConciseView
=======
The proposal is to add a new single-line default error message view called SimpleView
>>>>>>> Error-View
and add a new cmdlet (Resolve-ErrorRecord) to provide detailed error information.

__Key Design Considerations__

1. To reduce confusion and improve debugging success,
<<<<<<< HEAD
error messages by default should produce a single line of text, including the word “ERROR:”
to make consistent with Verbose and Warning messages. This is added to $errorView as view named "ConciseView".
=======
error messages should call WriteErrorLine to produce a single line of text, including the word “ERROR:”
to make consistent with Verbose and Warning messages. This is added to $errorView as view named "SimpleView".
>>>>>>> Error-View

- $ErrorView should contain these views

+ NormalView
+ CategoryView
<<<<<<< HEAD
+ ConciseView
+ DetailedView

- Error Message syntax for ConciseView
=======
+ SimpleView
+ DetailedView

- Error Message syntax for SimpleView
>>>>>>> Error-View

```powershell
ERROR: <Exception Message>
Expand Down Expand Up @@ -75,7 +95,11 @@ First parameter set
+ specifies one or more of last errors to display
+ Not required

<<<<<<< HEAD
Examples
=======
__Example__
>>>>>>> Error-View

```powershell
# Displays details of the last error displayed
Expand All @@ -86,12 +110,23 @@ $error[1] | Resolve-ErrorRecord

# Display detailed error information for the most recent 3 errors
Resolve-ErrorRecord -Newest 3
<<<<<<< HEAD

__Example 1__

```powershell
PS C:\test> Get-item c:\blah
Get-item : Cannot find path 'C:\blah' because it does not exist. At line:1 char:1
=======
```

__Example 1__
SimpleView of Error message. Resolve-ErrorRecord shows sample DetailedView

```powershell
PS C:\test> Get-item c:\blah
ERROR: Cannot find path 'C:\blah' because it does not exist.
>>>>>>> Error-View

PS C:\test> Resolve-ErrorRecord

Expand All @@ -104,6 +139,7 @@ Exception : System.Management.Automation.ItemNotFoundException: Cann
```

__Example 2__
<<<<<<< HEAD

```powershell
PS C:\test> slkjdfh
Expand All @@ -112,6 +148,31 @@ PS C:\test> $error[0] | Resolve-ErrorRecord

PSMessageDetails :
Exception : System.Management.Automation.CommandNotFoundException: The term 'slkjdfh' is not recognized as
=======
SimpleView of Error message. Piped error to Resolve-ErrorRecord shows sample DetailedView

```powershell
PS C:\test> slkjdfh
ERROR: The term 'slkjdfh' is not recognized as the name of a cmdlet, function, script file, or operable program.
PS C:\test> $error[0] | Resolve-ErrorRecord

PSMessageDetails :
Exception : System.Management.Automation.CommandNotFoundException:
The term 'slkjdfh' is not recognized as
```

__Example 3__
SimpleView of Inner exception if present. Sample of Resolve-ErrorRecord to provide DetailedView.

```powershell
PS> [System.Net.DNS]::GetHostByName('NoOnline')
ERROR: No such host is known.

PS>Resolve-ErrorRecord -Newest 1
Exception calling "GetHostByName" with "1" argument(s):
"No such host is known."
At line:1 char:1
>>>>>>> Error-View
```

## Alternate Proposals and Considerations
Expand Down