From 6605a5d7e7f64dcf487eb65abb76bf319b367adf Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Fri, 23 Feb 2024 17:25:24 +0530 Subject: [PATCH] Refactor getConfigFieldsInfo method in Start and PostgreSQLConfig classes --- .../java/io/supertokens/storage/postgresql/Start.java | 2 +- .../storage/postgresql/config/PostgreSQLConfig.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/supertokens/storage/postgresql/Start.java b/src/main/java/io/supertokens/storage/postgresql/Start.java index 8c245a76..e3b21b32 100644 --- a/src/main/java/io/supertokens/storage/postgresql/Start.java +++ b/src/main/java/io/supertokens/storage/postgresql/Start.java @@ -2784,7 +2784,7 @@ public Set getValidFieldsInConfig() { } @Override - public ArrayList getConfigFieldsInfo() throws InvalidConfigException { + public ArrayList getConfigFieldsInfo() { return PostgreSQLConfig.getConfigFieldsInfo(); } diff --git a/src/main/java/io/supertokens/storage/postgresql/config/PostgreSQLConfig.java b/src/main/java/io/supertokens/storage/postgresql/config/PostgreSQLConfig.java index 2180d9ea..32a182ec 100644 --- a/src/main/java/io/supertokens/storage/postgresql/config/PostgreSQLConfig.java +++ b/src/main/java/io/supertokens/storage/postgresql/config/PostgreSQLConfig.java @@ -159,7 +159,7 @@ public static Set getValidFields() { return validFields; } - public static ArrayList getConfigFieldsInfo() throws InvalidConfigException { + public static ArrayList getConfigFieldsInfo() { ArrayList result = new ArrayList(); for (String fieldId : PostgreSQLConfig.getValidFields()) { @@ -185,10 +185,8 @@ public static ArrayList getConfigFieldsInfo() throws InvalidCon type = "boolean"; } else if (fieldType == int.class || fieldType == long.class || fieldType == Integer.class) { type = "number"; - } - - if (type == null) { - throw new InvalidConfigException("Unsupported field type: " + fieldType.getName()); + } else { + throw new RuntimeException("Unknown field type " + fieldType.getName()); } result.add(new ConfigFieldInfo(name, description, isDifferentAcrossTenants, type));