Skip to content

Commit

Permalink
Merge pull request #5 from AzureAD/fix-conflictexception
Browse files Browse the repository at this point in the history
Fixed exception handling for HTTP errors thrown by the provider
  • Loading branch information
marcusca10 authored Feb 25, 2020
2 parents 145339d + b993367 commit a074698
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,23 @@ public virtual async Task<ActionResult<Resource>> Post([FromBody]T resource)

throw new HttpResponseException(HttpStatusCode.NotImplemented);
}
catch (HttpResponseException httpResponseException)
{
if (this.TryGetMonitor(out IMonitor monitor))
{
IExceptionNotification notification =
ExceptionNotificationFactory.Instance.CreateNotification(
httpResponseException,
correlationIdentifier,
ServiceNotificationIdentifiers.ControllerTemplatePostNotSupportedException);
monitor.Report(notification);
}

if (httpResponseException.Response.StatusCode == HttpStatusCode.Conflict)
return this.Conflict();
else
return this.BadRequest();
}
catch (Exception exception)
{
if (this.TryGetMonitor(out IMonitor monitor))
Expand Down

0 comments on commit a074698

Please sign in to comment.