Skip to content

chore(executor): print stack trace for exceptions #3469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,12 @@ public synchronized Status startBatchTxn(
} catch (SpannerException e) {
return sender.finishWithError(toStatus(e));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unexpected error: " + e.getMessage());
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT,
CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -730,7 +732,8 @@ public synchronized Status finish(Mode finishMode, OutcomeSender sender) {
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT,
CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.sendOutcome(outcomeBuilder.build());
} else if (batchTxn != null) {
Expand Down Expand Up @@ -1075,7 +1078,7 @@ private Status executeAction(
return outcomeSender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
} finally {
scope.close();
span.end();
Expand Down Expand Up @@ -1171,7 +1174,7 @@ private Status executeAdminAction(
return outcomeSender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1260,7 +1263,7 @@ private Status executeUpdateCloudInstance(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.finishWithOK();
}
Expand All @@ -1282,7 +1285,7 @@ private Status executeDeleteCloudInstance(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.finishWithOK();
}
Expand Down Expand Up @@ -1330,7 +1333,7 @@ private Status executeListCloudInstances(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1374,7 +1377,7 @@ private Status executeListCloudInstanceConfigs(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1405,7 +1408,7 @@ private Status executeGetCloudInstanceConfig(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1436,7 +1439,7 @@ private Status executeGetCloudInstance(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1466,7 +1469,7 @@ private Status executeCreateUserInstanceConfig(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.finishWithOK();
}
Expand All @@ -1486,7 +1489,7 @@ private Status executeDeleteUserInstanceConfig(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.finishWithOK();
}
Expand Down Expand Up @@ -1515,7 +1518,7 @@ private Status executeCreateCloudCustomEncryptedDatabase(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.finishWithOK();
}
Expand Down Expand Up @@ -1550,7 +1553,7 @@ private Status executeCreateCloudDatabase(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.finishWithOK();
}
Expand Down Expand Up @@ -1584,7 +1587,7 @@ private Status executeUpdateCloudDatabaseDdl(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.finishWithOK();
}
Expand All @@ -1605,7 +1608,7 @@ private Status executeDropCloudDatabase(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
return sender.finishWithOK();
}
Expand Down Expand Up @@ -1642,7 +1645,7 @@ private Status executeCreateCloudBackup(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1678,7 +1681,7 @@ private Status executeCopyCloudBackup(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1709,7 +1712,7 @@ private Status executeGetCloudBackup(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1743,7 +1746,7 @@ private Status executeUpdateCloudBackup(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand All @@ -1763,7 +1766,7 @@ private Status executeDeleteCloudBackup(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1803,7 +1806,7 @@ private Status executeListCloudBackups(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1840,7 +1843,7 @@ private Status executeListCloudBackupOperations(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1879,7 +1882,7 @@ private Status executeListCloudDatabases(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1918,7 +1921,7 @@ private Status executeListCloudDatabaseOperations(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1952,7 +1955,7 @@ private Status executeRestoreCloudDatabase(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -1983,7 +1986,7 @@ private Status executeGetCloudDatabase(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -2011,7 +2014,7 @@ private Status executeGetOperation(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand All @@ -2030,7 +2033,7 @@ private Status executeCancelOperation(
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -2120,10 +2123,11 @@ private Status executeGenerateDbPartitionsRead(
LOGGER.log(Level.WARNING, String.format("GenerateDbPartitionsRead failed for %s", action));
return sender.finishWithError(toStatus(e));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unexpected error: " + e.getMessage());
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -2166,10 +2170,11 @@ private Status executeGenerateDbPartitionsQuery(
LOGGER.log(Level.WARNING, String.format("GenerateDbPartitionsQuery failed for %s", action));
return sender.finishWithError(toStatus(e));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unexpected error: " + e.getMessage());
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -2198,10 +2203,11 @@ private Status executeExecutePartition(
} catch (SpannerException e) {
return sender.finishWithError(toStatus(e));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unexpected error: " + e.getMessage());
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand All @@ -2225,10 +2231,11 @@ private Status executePartitionedUpdate(
} catch (SpannerException e) {
return sender.finishWithError(toStatus(e));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unexpected error: " + e.getMessage());
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down Expand Up @@ -2478,10 +2485,11 @@ private Status executeStartTxn(
} catch (SpannerException e) {
return sender.finishWithError(toStatus(e));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unexpected error: " + e.getMessage());
return sender.finishWithError(
toStatus(
SpannerExceptionFactory.newSpannerException(
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
}
}

Expand Down
Loading