19 package com.basistech.df.cybertriage.autopsy.ctapi;
22 import java.util.Objects;
23 import org.apache.commons.lang3.StringUtils;
24 import org.apache.commons.lang3.exception.ExceptionUtils;
34 BAD_REQUEST(
"CT-400",
"Unknown or Bad request. Please contact Basis support at " + Constants.SUPPORT_AT_CYBERTRIAGE_DOT_COM +
" for help diagnosing the problem."),
35 INVALID_KEY(
"CT-401",
"An invalid license ID was used to access CyberTriage Cloud Service. Please contact Basis support " + Constants.SUPPORT_AT_CYBERTRIAGE_DOT_COM +
" for help diagnosing the problem."),
36 GATEWAY_TIMEOUT(
"CT-504",
"Request to CyberTriage Cloud Service timed out. Please retry after some time. If issue persists, please contact Basis support at " + Constants.SUPPORT_AT_CYBERTRIAGE_DOT_COM +
" for assistance."),
37 UN_AUTHORIZED(
"CT-403",
"An authorization error occurred. Please contact Basis support " + Constants.SUPPORT_AT_CYBERTRIAGE_DOT_COM +
" for help diagnosing the problem."),
38 PROXY_UNAUTHORIZED(
"CT-407",
"Proxy authentication failed. Please validate the connection settings from the Options panel Proxy Settings."),
39 TEMP_UNAVAILABLE(
"CT-500",
"CyberTriage Cloud Service temporarily unavailable; please try again later. If this problem persists, contact Basis support at " + Constants.SUPPORT_AT_CYBERTRIAGE_DOT_COM),
40 UNKNOWN(
"CT-080",
"Unknown error while communicating with CyberTriage Cloud Service. If this problem persists, contact Basis support at "+ Constants.SUPPORT_AT_CYBERTRIAGE_DOT_COM +
" for assistance."),
41 UNKNOWN_HOST(
"CT-081",
"Unknown host error. If this problem persists, contact Basis support at "+ Constants.SUPPORT_AT_CYBERTRIAGE_DOT_COM +
" for assistance."),
42 NETWORK_ERROR(
"CT-015",
"Error connecting to CyberTriage Cloud.\n"
43 +
"Check your firewall or proxy settings.\n"
44 +
"Contact Support (support@cybertriage.com) for further assistance");
48 private ErrorCode(String errorcode, String description) {
49 this.errorcode = errorcode;
50 this.description = description;
64 super(errorCode.name());
69 super(errorCode.name(), throwable);
79 return String.format(
"An API error %s occurred. Please try again, and contact Basis support at %s for help if the problem persists.",
80 StringUtils.isNotBlank(getCause().getLocalizedMessage()) ?
"("+getCause().getLocalizedMessage()+
")":
"(Unknown)",
81 Constants.SUPPORT_AT_CYBERTRIAGE_DOT_COM );
92 String stackTrace = ExceptionUtils.getStackTrace(throwable);
93 if (stackTrace.contains(
"UnknownHostException")) {
CTCloudException(CTCloudException.ErrorCode errorCode)
final ErrorCode errorCode
ErrorCode(String errorcode, String description)
CTCloudException(CTCloudException.ErrorCode errorCode, Throwable throwable)
static ErrorCode parseUnknownException(Throwable throwable)