Skip to content

Commit 46b3a9c

Browse files
authored
chore(spanner): add stack trace (#3288)
* chore(spanner): add stack trace * chore(spanner): update message
1 parent 599255c commit 46b3a9c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import com.google.cloud.spanner.encryption.CustomerManagedEncryption;
7676
import com.google.cloud.spanner.v1.stub.SpannerStubSettings;
7777
import com.google.common.base.Function;
78+
import com.google.common.base.Joiner;
7879
import com.google.common.base.Preconditions;
7980
import com.google.common.collect.Lists;
8081
import com.google.common.util.concurrent.ThreadFactoryBuilder;
@@ -191,6 +192,16 @@ public CloudClientExecutor(boolean enableGrpcFaultInjector) {
191192
this.enableGrpcFaultInjector = enableGrpcFaultInjector;
192193
}
193194

195+
// Helper for unexpected results.
196+
public static String unexpectedExceptionResponse(Exception e) {
197+
return "Unexpected error in Github Cloud Java Client Executor: "
198+
+ e
199+
+ " Msg: "
200+
+ e.getMessage()
201+
+ " Stack: "
202+
+ Joiner.on("\n").join(e.getStackTrace());
203+
}
204+
194205
/**
195206
* Implementation of a ReadWriteTransaction, which is a wrapper of the cloud TransactionRunner. It
196207
* stores all the status and related variables from the start to finish, and control the running
@@ -1083,7 +1094,7 @@ private Status executeCreateCloudInstance(
10831094
return sender.finishWithError(
10841095
toStatus(
10851096
SpannerExceptionFactory.newSpannerException(
1086-
ErrorCode.INVALID_ARGUMENT, "Unexpected error: " + e.getMessage())));
1097+
ErrorCode.INVALID_ARGUMENT, CloudClientExecutor.unexpectedExceptionResponse(e))));
10871098
}
10881099
return sender.finishWithOK();
10891100
}

0 commit comments

Comments
 (0)