Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Descriptive Pull Request Creation Errors #464

Merged
merged 2 commits into from
Aug 1, 2016
Merged

Conversation

paladique
Copy link
Contributor

In this specific instance, we notify the user when they are trying to a duplicate PR on a branch, but with just a "Validation Failed" message. A more informative message lies within the response from the exception. If the type of exception is checked (like APIValidationException), we can convert and grab the actual message we want to convey to the user. If it's not that type (it's null), then just display the exception message.

Fixes #453

//TODO:Will need a uniform solution to HTTP exception message handling
var apiException = ex as ApiValidationException;
var error = apiException?.ApiError?.Errors?.FirstOrDefault();
notifications.ShowError(error.Message ?? ex.Message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error can be null here, so it'll throw if you do error.Message, you need to null check there as well.

@shana
Copy link
Contributor

shana commented Aug 1, 2016

🚀 🚢

@shana shana merged commit c14da9b into master Aug 1, 2016
@shana shana deleted the fixes/453-descriptive-errors branch August 1, 2016 11:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants