Skip to content

Commit 95c3ceb

Browse files
committed
Add getExternalDocumentationLink
1 parent f36dd75 commit 95c3ceb

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

database-commons/src/main/java/io/cdap/plugin/db/DBErrorDetailsProvider.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.cdap.plugin.db;
1818

19+
import com.google.common.base.Strings;
1920
import com.google.common.base.Throwables;
2021
import io.cdap.cdap.api.exception.ErrorCategory;
2122
import io.cdap.cdap.api.exception.ErrorType;
@@ -48,7 +49,6 @@ public ProgramFailureException getExceptionDetails(Exception e, ErrorContext err
4849
if (t instanceof IllegalStateException) {
4950
return getProgramFailureException((IllegalStateException) t, errorContext);
5051
}
51-
5252
}
5353
return null;
5454
}
@@ -67,6 +67,14 @@ private ProgramFailureException getProgramFailureException(SQLException e, Error
6767
String errorMessageWithDetails = String.format(
6868
"Error occurred in the phase: '%s'. Error message: '%s'. Error code: '%s'. sqlState: '%s'",
6969
errorContext.getPhase(), errorMessage, errorCode, sqlState);
70+
String externalDocumentationLink = getExternalDocumentationLink();
71+
if (!Strings.isNullOrEmpty(externalDocumentationLink)) {
72+
if (!errorMessageWithDetails.endsWith(".")) {
73+
errorMessageWithDetails = errorMessageWithDetails + ".";
74+
}
75+
errorMessageWithDetails = String.format("%s For more details, see %s", errorMessageWithDetails,
76+
externalDocumentationLink);
77+
}
7078
return ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
7179
errorMessage, errorMessageWithDetails, getErrorTypeFromErrorCode(errorCode), false, e);
7280
}
@@ -99,7 +107,6 @@ private ProgramFailureException getProgramFailureException(IllegalStateException
99107
return ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN),
100108
errorMessage,
101109
String.format(errorMessageFormat, errorContext.getPhase(), errorMessage), ErrorType.SYSTEM, false, e);
102-
103110
}
104111

105112
/**

mysql-plugin/src/e2e-test/features/mysqlsink/RunTimeWithMacros.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ Feature: MySQL Sink - Run time scenarios (macro)
9999
And Run the Pipeline in Runtime with runtime arguments
100100
Then Wait till pipeline is in running state
101101
Then Open and capture logs
102+
And Open and capture logs
102103
And Verify the pipeline status is "Failed"
104+
And Close the pipeline logs
103105

104106
@BQ_SOURCE_TEST @MYSQL_TARGET_TABLE @Mysql_Required
105107
Scenario: Verify that the pipeline fails when user provides invalid Credentials for connection with Macros
@@ -135,4 +137,6 @@ Feature: MySQL Sink - Run time scenarios (macro)
135137
And Enter runtime argument value "invalid.password" for key "password"
136138
And Run the Pipeline in Runtime with runtime arguments
137139
And Wait till pipeline is in running state
140+
And Open and capture logs
138141
And Verify the pipeline status is "Failed"
142+
And Close the pipeline logs

mysql-plugin/src/e2e-test/features/mysqlsource/RunTimeWithMacros.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ Feature: MySQL Source - Run time scenarios (macro)
201201
And Enter runtime argument value "invalid.query" for key "importQuery"
202202
And Run the Pipeline in Runtime with runtime arguments
203203
And Wait till pipeline is in running state
204+
And Open and capture logs
204205
And Verify the pipeline status is "Failed"
206+
And Close the pipeline logs
205207

206208
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
207209
Scenario: Verify that pipeline fails when user provides invalid Credentials for connection with Macros
@@ -241,4 +243,6 @@ Feature: MySQL Source - Run time scenarios (macro)
241243
And Enter runtime argument value "invalid.password" for key "Password"
242244
And Run the Pipeline in Runtime with runtime arguments
243245
And Wait till pipeline is in running state
246+
And Open and capture logs
244247
And Verify the pipeline status is "Failed"
248+
And Close the pipeline logs

0 commit comments

Comments
 (0)