Skip to content
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

Better error handling when given a csproj or sln file #398

Closed
svermeulen opened this issue Aug 15, 2021 · 1 comment · Fixed by #402
Closed

Better error handling when given a csproj or sln file #398

svermeulen opened this issue Aug 15, 2021 · 1 comment · Fixed by #402
Assignees
Labels
Milestone

Comments

@svermeulen
Copy link

svermeulen commented Aug 15, 2021

When I attempted to use this, I misread the command line instructions and passed in a .sln file or a .csproj file because this is how the dotnet formatter works. This resulted in this output:

+dotnet csharpier Foo.sln
/Foo.sln                                                                                                                 - failed to compile
total time:                                                                          243ms
Total files:                                                                           1
Failed syntax tree validation:                                                         0
Threw exceptions while formatting:                                                     0
files that threw exceptions while validating syntax tree:                              0

Which led me to believe that the sln file was not compiling, and not that I was supplying an invalid file. I understand now how it is meant to work, but wanted to just suggest that this error message be improved. When not given a .cs file or a directory, can it print out clearer instructions?

EDIT: Or, alternatively, actually process csproj / sln files and format all the C# scripts inside them

@belav belav added area:cli priority:medium type:bug Something isn't working and removed type:bug Something isn't working labels Aug 15, 2021
@belav
Copy link
Owner

belav commented Aug 15, 2021

I like the idea of allowing someone to pass a csproj/sln file, I created #399 for adding support for it.
Even with that implemented, if someone passes a path to csharpier that it can't format it should definitely let the user know.

@belav belav self-assigned this Aug 15, 2021
belav added a commit that referenced this issue Aug 15, 2021
@belav belav added this to the 0.9.9 milestone Aug 16, 2021
belav added a commit that referenced this issue Aug 16, 2021
belav added a commit that referenced this issue Aug 16, 2021
shocklateboy92 added a commit that referenced this issue Aug 19, 2021
…arnings print. (#402)

* Adding new error for unsupported file type. Changing how errors and warnings print.

closes #398

* Fixing some failing tests

* Don't forget to test your tests

Co-authored-by: Lasath Fernando <devel@lasath.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants