@softvision/webpdf-wsclient-typescript
Version:
A simplified and optimized API client library for the webPDF server
53 lines • 2.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WsclientErrors = exports.WsclientError = void 0;
class WsclientError {
constructor(code, message) {
this.code = code;
this.message = message;
}
static getName(errorCode) {
for (let value of Object.values(exports.WsclientErrors)) {
if (value.getCode() === errorCode) {
return value;
}
}
return exports.WsclientErrors.UNKNOWN_EXCEPTION;
}
getCode() {
return this.code;
}
getMessage() {
return this.message;
}
equals(error) {
return error.code === this.code && error.message === this.message;
}
}
exports.WsclientError = WsclientError;
exports.WsclientErrors = {
UNKNOWN_EXCEPTION: new WsclientError(-1, "Unknown exception."),
UNKNOWN_WEBSERVICE_PROTOCOL: new WsclientError(-2, "The selected webservice protocol is unknown."),
UNKNOWN_WEBSERVICE_TYPE: new WsclientError(-3, "The selected webservice type is not available."),
INVALID_SOURCE_DOCUMENT: new WsclientError(-5, "Invalid file source."),
INVALID_HTTP_MESSAGE_CONTENT: new WsclientError(-6, "Failed to deserialize XML/JSON HTTP message content."),
INVALID_DOCUMENT: new WsclientError(-7, "The found document is invalid."),
INVALID_HISTORY_DATA: new WsclientError(-10, "Invalid history parameter."),
INVALID_WEBSERVICE_SESSION: new WsclientError(-11, "Creating a webservice instance failed for the selected session."),
INVALID_RESULT_DOCUMENT: new WsclientError(-12, "The resulting document is invalid"),
INVALID_URL: new WsclientError(-30, "Invalid URL."),
HTTP_IO_ERROR: new WsclientError(-31, "HTTP/HTTPS IO error."),
TLS_INITIALIZATION_FAILURE: new WsclientError(-32, "TLS agent initialization failed."),
HTTP_EMPTY_ENTITY: new WsclientError(-33, "HTTP entity is empty"),
HTTP_CUSTOM_ERROR: new WsclientError(-34, "HTTP custom error"),
UNKNOWN_HTTP_METHOD: new WsclientError(-35, "Unknown HTTP method"),
UNKNOWN_SESSION_TYPE: new WsclientError(-36, "Unknown session type"),
XML_OR_JSON_CONVERSION_FAILURE: new WsclientError(-37, "Unable to convert to XML/JSON"),
INVALID_AUTH_MATERIAL: new WsclientError(-40, "Authentication/authorization material is invalid"),
AUTHENTICATION_FAILURE: new WsclientError(-41, "The session authentication failed"),
SESSION_REFRESH_FAILURE: new WsclientError(-42, "Refreshing the session token failed"),
REST_EXECUTION: new WsclientError(-53, "REST web service execution error"),
AUTH_ERROR: new WsclientError(-54, "Authentication/Authorization failure."),
ADMIN_PERMISSION_ERROR: new WsclientError(-55, "Admin permission required.")
};
//# sourceMappingURL=WsclientError.js.map