[#14] add lombok and refactor exceptions. Provide validator.
All checks were successful
DCO / DCO (pull_request) Successful in 34s
All checks were successful
DCO / DCO (pull_request) Successful in 34s
Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
parent
15cf0893c7
commit
388428af76
87 changed files with 819 additions and 970 deletions
20
exceptions/pom.xml
Normal file
20
exceptions/pom.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>info.frostfs.sdk</groupId>
|
||||
<artifactId>frostfs-sdk-java</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>exceptions</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,49 @@
|
|||
package info.frostfs.sdk.constants;
|
||||
|
||||
public class ErrorConst {
|
||||
public static final String OBJECT_IS_NULL = "object must not be null";
|
||||
public static final String INPUT_PARAM_IS_MISSING = "input parameter is not present";
|
||||
public static final String SOME_PARAM_IS_MISSING = "one of the input parameters is not present";
|
||||
public static final String PARAM_IS_MISSING_TEMPLATE = "param %s is not present";
|
||||
public static final String PARAMS_ARE_MISSING_TEMPLATE = "params %s are not present";
|
||||
public static final String INPUT_PARAM_IS_MISSING_TEMPLATE = "%s value is not present";
|
||||
|
||||
public static final String INPUT_PARAM_GREATER_OR_EQUAL_ZERO = "%s must be greater than or equal to zero";
|
||||
public static final String INPUT_PARAM_GREATER_ZERO = "%s must be greater than zero";
|
||||
|
||||
public static final String REQUIRED_FIELD_TEMPLATE = "%s required field";
|
||||
|
||||
public static final String REQUIRED_PROTO_FIELD_TEMPLATE = "the proto message does not contain a field %s";
|
||||
public static final String UNSUPPORTED_PROTO_MESSAGE_TYPE_TEMPLATE = "unsupported proto message type: %s";
|
||||
public static final String PROTO_MESSAGE_IS_EMPTY_TEMPLATE = "proto message %s must not be empty";
|
||||
public static final String UNEXPECTED_MESSAGE_TYPE_TEMPLATE = "unexpected message type, expected %s, actually %s";
|
||||
|
||||
public static final String WIF_IS_INVALID = "WIF is invalid";
|
||||
public static final String UNEXPECTED_STREAM = "unexpected end of stream";
|
||||
public static final String INVALID_HOST_TEMPLATE = "host %s has invalid format. Error: %s";
|
||||
public static final String INVALID_RESPONSE = "invalid response";
|
||||
public static final String VERSION_UNSUPPORTED_TEMPLATE = "frostFS %s is not supported.";
|
||||
|
||||
public static final String UNKNOWN_ENUM_VALUE_TEMPLATE = "unknown %s value: %s";
|
||||
|
||||
public static final String INPUT_PARAM_IS_NOT_SHA256 = "%s must be a sha256 hash";
|
||||
public static final String DECODE_LENGTH_VALUE_TEMPLATE = "decode array length must be >= 4, but %s";
|
||||
public static final String INVALID_BASE58_CHARACTER_TEMPLATE = "invalid character in Base58: 0x%04x";
|
||||
public static final String INVALID_CHECKSUM = "checksum does not match";
|
||||
public static final String WRONG_SIGNATURE_SIZE_TEMPLATE = "wrong signature size. Expected length=%s, actual=%s";
|
||||
public static final String ENCODED_COMPRESSED_PUBLIC_KEY_WRONG_LENGTH_TEMPLATE =
|
||||
"publicKey isn't encoded compressed public key. Expected length=%s, actual=%s";
|
||||
public static final String UNCOMPRESSED_PUBLIC_KEY_WRONG_LENGTH_TEMPLATE =
|
||||
"compress argument isn't uncompressed public key. Expected length=%s, actual=%s";
|
||||
public static final String COMPRESSED_PUBLIC_KEY_WRONG_LENGTH_TEMPLATE =
|
||||
"decompress argument isn't compressed public key. Expected length=%s, actual=%s";
|
||||
|
||||
public static final String WRONG_UUID_SIZE_TEMPLATE = "uuid byte array length must be %s";
|
||||
|
||||
|
||||
public static final String FIELDS_DELIMITER_COMMA = ", ";
|
||||
public static final String FIELDS_DELIMITER_OR = " or ";
|
||||
|
||||
private ErrorConst() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package info.frostfs.sdk.exceptions;
|
||||
|
||||
public class ProcessFrostFSException extends RuntimeException {
|
||||
public ProcessFrostFSException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ProcessFrostFSException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package info.frostfs.sdk.exceptions;
|
||||
|
||||
public class TimeoutFrostFSException extends RuntimeException {
|
||||
public TimeoutFrostFSException() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package info.frostfs.sdk.exceptions;
|
||||
|
||||
public class ValidationFrostFSException extends RuntimeException {
|
||||
public ValidationFrostFSException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue