microsoft / vscode-powerquery-sdk

Power Query Connector Development SDK for VS Code
MIT License
72 stars 12 forks source link

MakePQX.exe - Throws exception on argument errors #99

Closed bgribaudo closed 2 years ago

bgribaudo commented 2 years ago

If the arguments passed to MakePQX.exe don't match its expectations, it has a tendency to throw an exception with stack trace, instead of displaying clean, concise error messaging.

Request: When command-line argument errors occur, could user-friendly errors be displayed without stack traces?

Examples of Current Behavior

When an invalid command is specified:

PS> .\MakePQX.exe x
Specify --help for a list of available options and commands.
Unexpected exception:
Microsoft.Extensions.CommandLineUtils.CommandParsingException: Unrecognized command or argument 'x'
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.HandleUnexpectedArg(CommandLineApplication command, String[] args, Int32 index, String argTypeName)
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.Mashup.MakePQX.Program.Main(String[] args) in C:\__w\1\s\Tools\MakePQX\Program.cs:line 207

When the expected arguments are not passed to a command

PS> .\MakePQX.exe compile
Unexpected exception:
System.ArgumentException: Build source directory: 'C:\[snip]\.vscode\extensions\powerquery.vscode-powerquery-sdk-0.1.3\.nuget\Microsoft.PowerQuery.SdkTools.2.110.1\tools' Expect only one power query file ending with either .pq or .m
   at MakePQX.Tasks.TaskStash.CollectFilesForOneMezProject(String nullableProjectDirectory) in C:\__w\1\s\Tools\MakePQX\Tasks\TaskStash.cs:line 110
   at MakePQX.Tasks.TaskStash.BuildMezProject(String nullableProjectDirectory, String directoryName, String fileName) in C:\__w\1\s\Tools\MakePQX\Tasks\TaskStash.cs:line 146
   at Microsoft.Mashup.MakePQX.Program.<>c__DisplayClass3_1.<Main>b__5() in C:\__w\1\s\Tools\MakePQX\Program.cs:line 56
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.Mashup.MakePQX.Program.Main(String[] args) in C:\__w\1\s\Tools\MakePQX\Program.cs:line 207
mattmasson commented 2 years ago

Fixed in the 2.110.2 release of the SDK Tools nuget (which should be automatically downloaded by the preview VSIX).

bgribaudo commented 2 years ago

Thank you!