2222import com .google .common .base .Throwables ;
2323import io .cdap .cdap .api .exception .ErrorCategory ;
2424import io .cdap .cdap .api .exception .ErrorCategory .ErrorCategoryEnum ;
25+ import io .cdap .cdap .api .exception .ErrorCodeType ;
2526import io .cdap .cdap .api .exception .ErrorType ;
2627import io .cdap .cdap .api .exception .ErrorUtils ;
2728import io .cdap .cdap .api .exception .ProgramFailureException ;
@@ -78,12 +79,13 @@ private ProgramFailureException getProgramFailureException(HttpResponseException
7879 String errorMessageFormat = "Error occurred in the phase: '%s'. Error message: %s" ;
7980
8081 String errorMessage = e .getMessage ();
82+ String externalDocumentationLink = null ;
8183 if (e instanceof GoogleJsonResponseException ) {
8284 GoogleJsonResponseException exception = (GoogleJsonResponseException ) e ;
8385 errorMessage = exception .getDetails () != null ? exception .getDetails ().getMessage () :
8486 exception .getMessage ();
8587
86- String externalDocumentationLink = getExternalDocumentationLink ();
88+ externalDocumentationLink = getExternalDocumentationLink ();
8789 if (!Strings .isNullOrEmpty (externalDocumentationLink )) {
8890
8991 if (!errorReason .endsWith ("." )) {
@@ -96,7 +98,8 @@ private ProgramFailureException getProgramFailureException(HttpResponseException
9698
9799 return ErrorUtils .getProgramFailureException (new ErrorCategory (ErrorCategoryEnum .PLUGIN ),
98100 errorReason , String .format (errorMessageFormat , errorContext .getPhase (), errorMessage ),
99- pair .getErrorType (), true , e );
101+ pair .getErrorType (), true , ErrorCodeType .HTTP , statusCode .toString (),
102+ externalDocumentationLink , e );
100103 }
101104
102105
0 commit comments