ic4y commented on code in PR #3598:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3598#discussion_r1035510867


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/xa/XaFacadeImplAutoLoad.java:
##########
@@ -89,18 +92,16 @@ public void open() throws SQLException {
         XADataSource ds;
         try {
             ds = (XADataSource) 
DataSourceUtils.buildCommonDataSource(jdbcConnectionOptions);
-        }
-        catch (Exception e) {
-            throw new SQLException(e);
+        } catch (Exception e) {
+            throw new 
JdbcConnectorException(JdbcConnectorErrorCode.CONNECT_DATABASE_FAILED, e);
         }
         xaConnection = ds.getXAConnection();
         xaResource = xaConnection.getXAResource();
         if (jdbcConnectionOptions.getTransactionTimeoutSec().isPresent()) {
             try {
                 
xaResource.setTransactionTimeout(jdbcConnectionOptions.getTransactionTimeoutSec().get());
-            }
-            catch (XAException e) {
-                throw new SQLException(e);
+            } catch (XAException e) {
+                throw new 
JdbcConnectorException(JdbcConnectorErrorCode.XA_EXCEPTION, e);

Review Comment:
   add info "unable to set XA transaction timeout"



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcExactlyOnceSinkWriter.java:
##########
@@ -171,7 +172,7 @@ private void beginTx() throws IOException {
         try {
             xaFacade.start(currentXid);
         } catch (Exception e) {
-            ExceptionUtils.rethrowIOException(e);
+            throw new 
JdbcConnectorException(JdbcConnectorErrorCode.XA_EXCEPTION, e);

Review Comment:
   add Info "unable to start xa transaction"



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/JdbcOutputFormat.java:
##########
@@ -79,9 +81,8 @@ public void open()
         throws IOException {
         try {
             connectionProvider.getOrEstablishConnection();
-        }
-        catch (Exception e) {
-            throw new IOException("unable to open JDBC writer", e);
+        } catch (Exception e) {
+            throw new 
JdbcConnectorException(CommonErrorCode.WRITER_OPERATION_FAILED, "unable to open 
JDBC writer", e);

Review Comment:
   Suggest use GET_CONNECTION_FAILED



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/xa/XaFacadeImplAutoLoad.java:
##########
@@ -89,18 +92,16 @@ public void open() throws SQLException {
         XADataSource ds;
         try {
             ds = (XADataSource) 
DataSourceUtils.buildCommonDataSource(jdbcConnectionOptions);
-        }
-        catch (Exception e) {
-            throw new SQLException(e);
+        } catch (Exception e) {
+            throw new 
JdbcConnectorException(JdbcConnectorErrorCode.CONNECT_DATABASE_FAILED, e);

Review Comment:
   add info "unable to build XADataSource"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to