Skip to content

Error handling and error messages #372

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
juneb opened this issue Nov 25, 2015 · 2 comments
Closed

Error handling and error messages #372

juneb opened this issue Nov 25, 2015 · 2 comments

Comments

@juneb
Copy link
Contributor

juneb commented Nov 25, 2015

I've seen several cases like this one where we write a non-terminating error and then provide results. We need to review our error handling. Should this be a terminating error? Or, should it be an error that the end-user sees? How should the user fix this error?

PS C:\ps-test> Invoke-ScriptAnalyzer -ScriptDefinition "function get-Widgets { Hello, World }"
Invoke-ScriptAnalyzer : Parse error in script definition: Missing argument in parameter list at line 1 column 29.
At line:1 char:1

  • Invoke-ScriptAnalyzer -ScriptDefinition "function get-Widgets { Hello ...
  • - CategoryInfo          : ParserError: (MissingArgument:String) [Invoke-ScriptAnalyzer], ParseException
    - FullyQualifiedErrorId : Parse error in script definition:  Missing argument in parameter list at line 1 column 29.,Micr
      osoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand
    
    

RuleName Severity FileName Line Message


PSUseSingularNouns Warning 1 The cmdlet 'get-Widgets' uses a plural noun. A singular
noun should be used instead.

@raghushantha
Copy link
Member

Hi June.

Parsing errors are non-terminating and the Engine continues to run rules against the provided Scripts.

We have a discussion around converting these errors to DiagnosticRecords - to provide a unified experience in the output.
#264

The only terminating errors would be when using CustomRulePaths and Profiles (Configurations)

@raghushantha
Copy link
Member

We have a consistent experience for error cases in v1.2.0 of ScriptAnalyzer. Please try it out and let us know if you have feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants