JetBrains / YouTrackSharp

.NET Standard 2.0 Library to access YouTrack API.
https://www.jetbrains.com/youtrack
Apache License 2.0
134 stars 105 forks source link

Better exception for TimeTrackingService.GetWorkTypesForProject() #80

Closed jrossgowan-pulsemining closed 6 years ago

jrossgowan-pulsemining commented 6 years ago

I have a program that calls GetWorkTypesForProject on each project in a YouTrack instance. Recently, someone added a project in which time tracking was disabled. YouTrack returns an HTTP 400 response with an error message when I call GetWorkTypesForProject on this project. I'd like to ignore this error, but on the C# side, I just get a HttpRequestException, which is hard to distinguish from other transient/critical HTTP errors like 503.

Expected behavior

Calling GetWorkTypesForProject() when time tracking is disabled throws an informative exception (YouTrackErrorException?)

Actual behavior

Calling GetWorkTypesForProject() when time tracking is disabled throws an HttpRequestException.

Steps to reproduce the behavior

Call TimeTrackingService.GetWorkTypesForProject() on a project in which time tracking is disabled.

maartenba commented 6 years ago

Thanks, just pushed a prerelease version that has this covered: https://github.com/JetBrains/YouTrackSharp/releases/tag/4.0.0-develop-201809040744

jrossgowan-pulsemining commented 6 years ago

Great, thanks!