Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@faniereynders
Copy link
Contributor

@faniereynders faniereynders commented Nov 9, 2018

Added support for handling validation-based exceptions according to the RFC 7807 specification.

A new exception ValidationApiException derived from ApiException is introduced and allows one to catch specific validation exceptions in a declarative way:

//...
try
{
   var result = await awesomeApi.GetFooAsync("bar");
}
catch (ValidationApiException ex)
{
   //handle validation here by using ex.Content, which is type of ProblemDetails
}
catch (ApiException ex)
{
   //other exception handling
}
//...

Resolved #470

@anaisbetts
Copy link
Member

Seems reasonable. @onovotny?

{
public class ProblemDetails
{
public Dictionary<string, string[]> Errors { get; set; } = new Dictionary<string, string[]>();
Copy link
Member

Choose a reason for hiding this comment

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

@paulcbetts any thoughts on using the concrete type here vs an IDictionary<string,string> or IReadOnlyDictionary<string, string>?

@clairernovotny
Copy link
Member

@paulcbetts LGTM with the one style question design question you.

@clairernovotny
Copy link
Member

@faniereynders Would you please add/update relevant documentation to cover this scenario?

@faniereynders
Copy link
Contributor Author

@onovotny certainly, are you referring to the documentation in the code itself? Please point me to the specific place, I'm new here :)

@clairernovotny
Copy link
Member

clairernovotny commented Nov 10, 2018

Hi @faniereynders there are two things:

  1. Any XML doc comments for public members of types you added
  2. Usage here: https://github.com/reactiveui/refit/blob/master/README.md

Please add them to this PR and we can merge them together.

GitHub
The automatic type-safe REST library for Xamarin and .NET - reactiveui/refit

@faniereynders
Copy link
Contributor Author

@onovotny I've updated the docs, hope it's all good now?


namespace Refit
{
public class ProblemDetails
Copy link
Member

Choose a reason for hiding this comment

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

Please add a doc comment to the type itself

@clairernovotny
Copy link
Member

@faniereynders Looks like one missing doc comment and then we can merge

@faniereynders
Copy link
Contributor Author

@onovotny oops! Fixed it now :)

@clairernovotny clairernovotny merged commit dc69773 into reactiveui:master Nov 11, 2018
@lock lock bot locked and limited conversation to collaborators Jun 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for RFC 7807 - Problem Details for HTTP APIs

3 participants