[NO ISSUE] Introduce External Sink Error for write to

Change-Id: I6c34ca6cb3e5ef39a4c9f3c11cb55a748758e85b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18211
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Hussain Towaileb <hussainht@gmail.com>
Reviewed-by: Wail Alkowaileet <wael.y.k@gmail.com>
diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/writer/AbstractCloudExternalFileWriter.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/writer/AbstractCloudExternalFileWriter.java
index e2c09eb..bbae29a 100644
--- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/writer/AbstractCloudExternalFileWriter.java
+++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/writer/AbstractCloudExternalFileWriter.java
@@ -99,7 +99,7 @@
             throw e;
         } catch (Exception e) {
             if (isSdkException(e)) {
-                throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, e, getMessageOrToString(e));
+                throw RuntimeDataException.create(ErrorCode.EXTERNAL_SINK_ERROR, e, getMessageOrToString(e));
             }
             throw e;
         }
@@ -116,7 +116,7 @@
             throw e;
         } catch (Exception e) {
             if (isSdkException(e)) {
-                throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, e, getMessageOrToString(e));
+                throw RuntimeDataException.create(ErrorCode.EXTERNAL_SINK_ERROR, e, getMessageOrToString(e));
             }
             throw HyracksDataException.create(e);
         }
@@ -130,7 +130,7 @@
             throw e;
         } catch (Exception e) {
             if (isSdkException(e)) {
-                throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, e, getMessageOrToString(e));
+                throw RuntimeDataException.create(ErrorCode.EXTERNAL_SINK_ERROR, e, getMessageOrToString(e));
             }
             throw HyracksDataException.create(e);
         }
diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/writer/S3ExternalFileWriterFactory.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/writer/S3ExternalFileWriterFactory.java
index cb0a6e7..5faa8e1 100644
--- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/writer/S3ExternalFileWriterFactory.java
+++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/writer/S3ExternalFileWriterFactory.java
@@ -129,11 +129,11 @@
             if (e.getCause() instanceof NoSuchBucketException) {
                 throw CompilationException.create(ErrorCode.EXTERNAL_SOURCE_CONTAINER_NOT_FOUND, bucket);
             } else {
-                throw CompilationException.create(ErrorCode.EXTERNAL_SOURCE_ERROR,
+                throw CompilationException.create(ErrorCode.EXTERNAL_SINK_ERROR,
                         ExceptionUtils.getMessageOrToString(e));
             }
         } catch (SdkException e) {
-            throw CompilationException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, e, getMessageOrToString(e));
+            throw CompilationException.create(ErrorCode.EXTERNAL_SINK_ERROR, e, getMessageOrToString(e));
         }
     }
 
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index ab028de..8994fc3 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -298,6 +298,7 @@
     UNKNOWN_STORAGE_FORMAT(1193),
     UNSUPPORTED_INDEX_IN_COLUMNAR_FORMAT(1194),
     COMPOSITE_KEY_NOT_SUPPORTED(1195),
+    EXTERNAL_SINK_ERROR(1196),
 
     // Feed errors
     DATAFLOW_ILLEGAL_STATE(3001),
diff --git a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
index bc1b0d0..8d624d4 100644
--- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
+++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
@@ -300,6 +300,7 @@
 1193 = Unknown storage format '%1$s'
 1194 = Index type '%1$s' is not supported with columnar storage format
 1195 = Composite key is not allowed, only single key must be specified.
+1196 = External sink error. %1$s
 
 # Feed Errors
 3001 = Illegal state.