in src/app/common/http-client.ts [193:262]
private apiErrorFromHttp(httpError): ApiError {
let msg = "";
let apiError: ApiError = null;
if ((httpError)._body) {
try {
apiError = JSON.parse(httpError._body);
}
catch (parseError) {
}
}
if (apiError == null) {
apiError = new ApiError();
apiError.status = httpError.status;
}
if (httpError.status === 400) {
if (apiError && apiError.title == "Invalid parameter") {
var parameterName = this.parseParameterName(apiError.name);
msg = "An invalid value was given for " + parameterName + ".";
if (apiError.detail) {
msg += "\n" + apiError.detail;
}
}
}
if (httpError.status == 403) {
// TODO: Invalid token
if (apiError && apiError.title == "Object is locked") {
apiError.type = ApiErrorType.SectionLocked;
msg = "The feature's settings could not be loaded. This happens when the feature is locked at the current configuration level and the feature's settings have been modified. To fix this, manually remove any local changes to the feature or unlock the feature at the parent level.";
}
if (apiError && apiError.title == "Forbidden" && apiError.name) {
if (apiError[apiError.name]) {
msg = "Forbidden: '" + apiError[apiError.name] + "'";
}
else {
msg = "Forbidden: '" + apiError.name + "'";
}
if (apiError.detail) {
msg += "\n" + apiError.detail;
}
}
}
if (httpError.status == 404) {
if (apiError && apiError.detail === "IIS feature not installed") {
apiError.type = ApiErrorType.FeatureNotInstalled;
msg = apiError.detail + "\n" + apiError.name;
}
else {
msg = "The resource could not be found";
apiError.type = ApiErrorType.NotFound;
}
}
if (httpError.status == 500) {
// TODO: Invalid token
if (apiError.detail == "Dism Error") {
msg = "An error occured enabling " + apiError.feature;
if (apiError.exit_code == 'B7') {
msg += "\nThe specified image is currently being serviced by another DISM operation"
}
msg += "\nError code: " + apiError.exit_code;
}
else {
msg = apiError.detail || "";
}
}
apiError.message = msg;
return apiError;
}