private static final long serialVersionUID = 8540515029592553577L;
static final int STATUS_CODE = HttpURLConnection.HTTP_BAD_REQUEST;
public static BadRequest create(String msg) {
ErrorInfo errInfo = ErrorInfo.parse(msg);
ErrorType type = errInfo.getErrorType();
if (type == ErrorType.UNSUPPORTED_FILE_FORMAT) {
return new UnsupportedFileFormat(errInfo.getErrorMessage());
}
else if (type == ErrorType.UNSUPPORTED_QUERY_LANGUAGE) {
return new UnsupportedQueryLanguage(errInfo.getErrorMessage());
}
else if (type == ErrorType.MALFORMED_DATA) {
return new MalformedData(errInfo.getErrorMessage());
}
else if (type == ErrorType.MALFORMED_QUERY) {
return new MalformedQuery(errInfo.getErrorMessage());
}
else {
return new BadRequest(errInfo.toString());
}
}