private static void ValidateClassification( string suberror, UiRequiredExceptionClassification expectedClassification, bool expectUiRequiredException = true) { var newJsonError = JsonError.Replace("some_suberror", suberror); // Arrange HttpResponse httpResponse = new HttpResponse() { Body = newJsonError, StatusCode = HttpStatusCode.BadRequest, // 400 }; // Act var msalException = MsalServiceExceptionFactory.FromHttpResponse(ExCode, ExMessage, httpResponse); Assert.AreEqual(ExCode, msalException.ErrorCode); Assert.AreEqual(ExMessage, msalException.Message); Assert.AreEqual("some_claims", msalException.Claims); Assert.AreEqual("6347d33d-941a-4c35-9912-a9cf54fb1b3e", msalException.CorrelationId); Assert.AreEqual(suberror ?? "", msalException.SubError); if (expectUiRequiredException) { Assert.AreEqual(expectedClassification, (msalException as MsalUiRequiredException).Classification); } ValidateExceptionProductInformation(msalException); }
/// <summary> /// Initializes a new instance of the exception class with a specified /// error code, error message and inner exception indicating the root cause. /// </summary> /// <param name="errorCode"> /// The error code returned by the service or generated by the client. This is the code you can rely on /// for exception handling. /// </param> /// <param name="errorMessage">The error message that explains the reason for the exception.</param> /// <param name="innerException">Represents the root cause of the exception.</param> /// <param name="classification">A higher level description for this exception, that allows handling code to /// understand what type of action it needs to take to resolve the issue. </param> public MsalUiRequiredException(string errorCode, string errorMessage, Exception innerException, UiRequiredExceptionClassification classification) : base(errorCode, errorMessage, innerException) { _classification = classification; }