Merge branch 'gerrit/trinity' into 'gerrit/goldfish'

Ext-ref: MB-64269
Change-Id: I35b32ae2ded466ed4707776aacb9d9be496d2be8
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
index 50c75ff..5274c44 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
@@ -103,14 +103,17 @@
 
             try {
                 builder.setCredentials(GoogleCredentials.getApplicationDefault());
-            } catch (IOException ex) {
+            } catch (Exception ex) {
                 throw CompilationException.create(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
             }
         } else if (jsonCredentials != null) {
             try (InputStream credentialsStream = new ByteArrayInputStream(jsonCredentials.getBytes())) {
                 builder.setCredentials(GoogleCredentials.fromStream(credentialsStream));
             } catch (IOException ex) {
-                throw new CompilationException(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
+                throw CompilationException.create(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
+            } catch (Exception ex) {
+                throw new CompilationException(EXTERNAL_SOURCE_ERROR,
+                        "Encountered an issue while processing the JSON credentials. Please ensure the provided credentials are valid.");
             }
         } else {
             builder.setCredentials(NoCredentials.getInstance());