Skip to content

Commit 550f350

Browse files
committed
Remove wrapping actual exception in IOException
1 parent efeef28 commit 550f350

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/main/java/io/cdap/plugin/gcp/bigquery/sink/BigQueryOutputFormat.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ public void checkOutputSpecs(JobContext job) throws FileAlreadyExistsException,
192192
} catch (GeneralSecurityException gse) {
193193
String errorMessage = "Failed to create BigQuery client";
194194
throw ErrorUtils.getProgramFailureException(
195-
new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), errorMessage,
196-
String.format(errorMessageFormat, ErrorPhase.VALIDATING_OUTPUT_SPECS, errorMessage), ErrorType.SYSTEM, true,
197-
new IOException(errorMessage, gse));
195+
new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), errorMessage, String.format(errorMessageFormat,
196+
ErrorPhase.VALIDATING_OUTPUT_SPECS, errorMessage), ErrorType.SYSTEM, true, gse);
198197
}
199198

200199
// Let delegate process its checks.
@@ -228,8 +227,7 @@ public static class BigQueryOutputCommitter extends ForwardingBigQueryFileOutput
228227
String errorMessage = "Failed to create BigQuery client";
229228
throw ErrorUtils.getProgramFailureException(
230229
new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), errorMessage,
231-
String.format(errorMessageFormat, ErrorPhase.COMMITTING, errorMessage), ErrorType.SYSTEM, true,
232-
new IOException(errorMessage, e));
230+
String.format(errorMessageFormat, ErrorPhase.COMMITTING, errorMessage), ErrorType.SYSTEM, true, e);
233231
}
234232
}
235233

@@ -290,8 +288,7 @@ public void commitJob(JobContext jobContext) throws IOException {
290288
String errorMessage = "Failed to import GCS into BigQuery.";
291289
throw ErrorUtils.getProgramFailureException(
292290
new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), errorMessage,
293-
String.format(errorMessageFormat, ErrorPhase.COMMITTING, errorMessage), ErrorType.SYSTEM, true,
294-
new IOException(errorMessage, e));
291+
String.format(errorMessageFormat, ErrorPhase.COMMITTING, errorMessage), ErrorType.SYSTEM, true, e);
295292
}
296293

297294
cleanup(jobContext);
@@ -658,8 +655,7 @@ private static Optional<TableSchema> getTableSchema(Configuration conf) throws I
658655
BigQueryConfiguration.OUTPUT_TABLE_SCHEMA.getKey());
659656
throw ErrorUtils.getProgramFailureException(
660657
new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), errorMessage,
661-
String.format(errorMessageFormat, ErrorPhase.COMMITTING, errorMessage), ErrorType.SYSTEM, true,
662-
new IOException(errorMessage, e));
658+
String.format(errorMessageFormat, ErrorPhase.COMMITTING, errorMessage), ErrorType.SYSTEM, true, e);
663659
}
664660
}
665661
return Optional.empty();

0 commit comments

Comments
 (0)