Skip to content

Commit 0be0a4f

Browse files
SK-2286 add error logs for vault url validations
1 parent 9fc0840 commit 0be0a4f

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

common/src/main/java/com/skyflow/logs/ErrorLogs.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public enum ErrorLogs {
2525
EMPTY_ROLES("Invalid credentials. Roles can not be empty."),
2626
EMPTY_OR_NULL_ROLE_IN_ROLES("Invalid credentials. Role can not be null or empty in roles at index %s1."),
2727
EMPTY_OR_NULL_CONTEXT("Invalid credentials. Context can not be empty."),
28+
EMPTY_VAULT_URL("Invalid vault config. Vault URL can not be empty."),
29+
INVALID_VAULT_URL_FORMAT("Invalid vault config. Vault URL format is incorrect"),
2830

2931
// Bearer token generation
3032
INVALID_BEARER_TOKEN("Bearer token is invalid or expired."),
@@ -49,6 +51,8 @@ public enum ErrorLogs {
4951
EMPTY_TABLE_NAME("Invalid %s1 request. Table name can not be empty."),
5052
VALUES_IS_REQUIRED("Invalid %s1 request. Values are required."),
5153
EMPTY_VALUES("Invalid %s1 request. Values can not be empty."),
54+
RECORD_SIZE_EXCEED("Maximum number of records exceeded. The limit is 10000."),
55+
TOKENS_SIZE_EXCEED("Maximum number of tokens exceeded. The limit is 10000."),
5256
EMPTY_OR_NULL_VALUE_IN_VALUES("Invalid %s1 request. Value can not be null or empty in values for key \"%s2\"."),
5357
EMPTY_OR_NULL_KEY_IN_VALUES("Invalid %s1 request. Key can not be null or empty in values"),
5458
EMPTY_UPSERT("Invalid %s1 request. Upsert can not be empty."),

common/src/main/java/com/skyflow/utils/BaseUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ public static String getEnvVaultURL() throws SkyflowException {
5353
vaultURL = dotenv.get("VAULT_URL");
5454
}
5555
if (vaultURL != null && vaultURL.trim().isEmpty()) {
56+
LogUtil.printErrorLog(ErrorLogs.EMPTY_VAULT_URL.getLog());
5657
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyVaultUrl.getMessage());
5758
} else if (vaultURL != null && !vaultURL.startsWith(BaseConstants.SECURE_PROTOCOL)) {
59+
LogUtil.printErrorLog(ErrorLogs.INVALID_VAULT_URL_FORMAT.getLog());
5860
throw new SkyflowException( ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.InvalidVaultUrlFormat.getMessage());
5961
}
6062
return vaultURL;

v3/src/main/java/com/skyflow/utils/validations/Validations.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public static void validateInsertRequest(InsertRequest insertRequest) throws Sky
4747
));
4848
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.EmptyValues.getMessage());
4949
} else if(values.size() > 10000) {
50+
LogUtil.printErrorLog(ErrorLogs.RECORD_SIZE_EXCEED.getLog());
5051
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.RecordSizeExceedError.getMessage());
5152
} else if (upsert != null && upsert.isEmpty()){
5253
LogUtil.printErrorLog(Utils.parameterizedString(
@@ -85,6 +86,7 @@ public static void validateDetokenizeRequest(DetokenizeRequest request) throws S
8586
}
8687
List<String> tokens = request.getTokens();
8788
if(tokens.size() > 10000) {
89+
LogUtil.printErrorLog(ErrorLogs.TOKENS_SIZE_EXCEED.getLog());
8890
throw new SkyflowException(ErrorCode.INVALID_INPUT.getCode(), ErrorMessage.TokensSizeExceedError.getMessage());
8991
}
9092
if (tokens == null || tokens.isEmpty()) {

0 commit comments

Comments
 (0)