-
Notifications
You must be signed in to change notification settings - Fork 136
Revert "feat: include PostgreSQL error code in exceptions" #4238
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,7 +16,6 @@ | |||||
|
|
||||||
| package com.google.cloud.spanner.spi.v1; | ||||||
|
|
||||||
| import static com.google.cloud.spanner.SpannerExceptionFactory.asSpannerException; | ||||||
| import static com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException; | ||||||
| import static com.google.cloud.spanner.ThreadFactoryUtil.tryCreateVirtualThreadPerTaskExecutor; | ||||||
|
|
||||||
|
|
@@ -539,7 +538,7 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCalla | |||||
| // is actually running. | ||||||
| checkEmulatorConnection(options, channelProvider, credentialsProvider, emulatorHost); | ||||||
| } catch (Exception e) { | ||||||
| throw asSpannerException(e); | ||||||
| throw newSpannerException(e); | ||||||
| } | ||||||
| } else { | ||||||
| this.databaseAdminStub = null; | ||||||
|
|
@@ -727,7 +726,7 @@ private <T> T runWithRetryOnAdministrativeRequestsExceeded(Callable<T> callable) | |||||
| new AdminRequestsLimitExceededRetryAlgorithm<>(), | ||||||
| NanoClock.getDefaultClock()); | ||||||
| } catch (RetryHelperException e) { | ||||||
| throw asSpannerException(e.getCause()); | ||||||
| throw SpannerExceptionFactory.asSpannerException(e.getCause()); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change to fully qualify
Suggested change
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -1318,7 +1317,7 @@ public OperationFuture<Empty, UpdateDatabaseDdlMetadata> updateDatabaseDdl( | |||||
| throw newSpannerException(e); | ||||||
| } catch (ExecutionException e) { | ||||||
| Throwable t = e.getCause(); | ||||||
| SpannerException se = asSpannerException(t); | ||||||
| SpannerException se = SpannerExceptionFactory.asSpannerException(t); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to other comments, this change to fully qualify
Suggested change
|
||||||
| if (se instanceof AdminRequestsPerMinuteExceededException) { | ||||||
| // Propagate this to trigger a retry. | ||||||
| throw se; | ||||||
|
|
@@ -1984,12 +1983,8 @@ private static <T> T get(final Future<T> future) throws SpannerException { | |||||
| // We are the sole consumer of the future, so cancel it. | ||||||
| future.cancel(true); | ||||||
| throw SpannerExceptionFactory.propagateInterrupt(e); | ||||||
| } catch (ExecutionException e) { | ||||||
| throw asSpannerException(e.getCause()); | ||||||
| } catch (CancellationException e) { | ||||||
| } catch (Exception e) { | ||||||
| throw newSpannerException(context, e, null); | ||||||
| } catch (Exception exception) { | ||||||
| throw asSpannerException(exception); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -2227,7 +2222,7 @@ public void onError(Throwable t) { | |||||
| if (this.consumer.cancelQueryWhenClientIsClosed()) { | ||||||
| unregisterResponseObserver(this); | ||||||
| } | ||||||
| consumer.onError(asSpannerException(t)); | ||||||
| consumer.onError(newSpannerException(t)); | ||||||
| } | ||||||
|
|
||||||
| @Override | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems inconsistent with the rest of the revert. Other occurrences of
asSpannerExceptionare being changed tonewSpannerException, but this one is kept and fully qualified. For consistency, shouldn't this also be changed tonewSpannerException(t)? The static import fornewSpannerExceptionis available.