diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Authoring/Generated/IModel.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Authoring/Generated/IModel.cs
index 4e3abf48133e..a0d9771b8f67 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Authoring/Generated/IModel.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Authoring/Generated/IModel.cs
@@ -40,7 +40,7 @@ public partial interface IModel
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
diff --git a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Authoring/Generated/Model.cs b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Authoring/Generated/Model.cs
index 2ced64aad804..c7a221276ba2 100644
--- a/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Authoring/Generated/Model.cs
+++ b/src/SDKs/CognitiveServices/dataPlane/Language/LUIS/Authoring/Generated/Model.cs
@@ -68,7 +68,7 @@ public Model(LUISAuthoringClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -166,12 +166,19 @@ public Model(LUISAuthoringClient client)
string _responseContent = null;
if ((int)_statusCode != 201)
{
- var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);