Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error = errorRep;
} else {
return this.handleInvalidResponse(ErrorCategory.HttpServerError);
}
} else if (response.status <= 0) {
// failed to connect
category = ErrorCategory.ClientError;
error = `Failed to connect to server: ${response.url || 'unknown'}`;
} else {
category = ErrorCategory.HttpClientError;
const message = (response.headers && response.headers.get('warning')) || 'Unknown client HTTP error';
if (response.status === HttpStatusCode.BadRequest ||
response.status === HttpStatusCode.UnprocessableEntity) {
// these errors should contain a map
error = new Ro.ErrorMap(response.error as Ro.IValueMap | Ro.IObjectOfType,
response.status,
message);
} else if (response.status === HttpStatusCode.NotFound && this.isObjectUrl(originalUrl)) {
// were looking for an object an got not found - object may be deleted
// treat as http problem.
category = ErrorCategory.HttpClientError;
error = `Failed to connect to server: ${response.url || 'unknown'}`;
} else if (response.status === HttpStatusCode.NotFound) {
// general not found other than object - assume client programming error
category = ErrorCategory.ClientError;
error = `Failed to connect to server: ${response.url || 'unknown'}`;
} else {
error = message;
}
}
.then((reloadedObj: Ro.DomainObjectRepresentation) => {
if (this.routeData.dialogId) {
this.urlManager.closeDialogReplaceHistory(this.routeData.dialogId, this.onPaneId);
}
this.reset(reloadedObj, this.routeData, true);
const em = new Ro.ErrorMap({}, 0, Msg.concurrencyMessage);
Helpers.handleErrorResponse(em, this, this.properties);
})
.catch((reject: ErrorWrapper) => this.error.handleError(reject));
const rejectAsNeedSelection = (action: Ro.ActionRepresentation | Ro.InvokableActionMember): ErrorWrapper | null => {
if (this.isLocallyContributed(action)) {
if (selected.length === 0) {
const em = new Ro.ErrorMap({}, 0, Msg.noItemsSelected);
const rp = new ErrorWrapper(ErrorCategory.HttpClientError, HttpStatusCode.UnprocessableEntity, em);
return rp;
}
}
return null;
};