Skip to content

Commit a074698

Browse files
authored
Merge pull request #5 from AzureAD/fix-conflictexception
Fixed exception handling for HTTP errors thrown by the provider
2 parents 145339d + b993367 commit a074698

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Microsoft.SystemForCrossDomainIdentityManagement/Service/Controllers/ControllerTemplate.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,23 @@ public virtual async Task<ActionResult<Resource>> Post([FromBody]T resource)
609609

610610
throw new HttpResponseException(HttpStatusCode.NotImplemented);
611611
}
612+
catch (HttpResponseException httpResponseException)
613+
{
614+
if (this.TryGetMonitor(out IMonitor monitor))
615+
{
616+
IExceptionNotification notification =
617+
ExceptionNotificationFactory.Instance.CreateNotification(
618+
httpResponseException,
619+
correlationIdentifier,
620+
ServiceNotificationIdentifiers.ControllerTemplatePostNotSupportedException);
621+
monitor.Report(notification);
622+
}
623+
624+
if (httpResponseException.Response.StatusCode == HttpStatusCode.Conflict)
625+
return this.Conflict();
626+
else
627+
return this.BadRequest();
628+
}
612629
catch (Exception exception)
613630
{
614631
if (this.TryGetMonitor(out IMonitor monitor))

0 commit comments

Comments
 (0)