@@ -88,8 +88,6 @@ public String toString() {
8888 * <li>{@code CLIENT_REDIRECT_ERROR}: Problem handling HTTP redirects.
8989 * <li>{@code CLIENT_AUTHENTICATION_ERROR}: Error during credential acquisition or
9090 * application.
91- * <li>{@code CLIENT_UNKNOWN_ERROR}: Other unclassified client-side network or protocol
92- * errors.
9391 * </ul>
9492 * <li><b>Language-specific error type:</b> The class or struct name of the exception or error
9593 * if available. This must be low-cardinality, meaning it returns the short name of the
@@ -174,13 +172,12 @@ private static String getClientSideError(Throwable error) {
174172 if (error instanceof IllegalArgumentException ) { // This covers CLIENT_REQUEST_ERROR
175173 return ErrorType .CLIENT_REQUEST_ERROR .toString ();
176174 }
177- if (error . getClass (). getSimpleName (). contains ( "RequestBodyException" )) {
175+ if (isRequestBodyError ( error )) {
178176 return ErrorType .CLIENT_REQUEST_BODY_ERROR .toString ();
179177 }
180- if (error . getClass (). getSimpleName (). contains ( "UnknownClientException" )) {
178+ if (isClientUnknownError ( error )) {
181179 return ErrorType .CLIENT_UNKNOWN_ERROR .toString ();
182180 }
183-
184181 return null ;
185182 }
186183
@@ -208,4 +205,12 @@ private static boolean isClientRedirectError(Throwable e) {
208205 private static boolean isClientAuthenticationError (Throwable e ) {
209206 return e .getClass ().getName ().contains ("GoogleAuthException" );
210207 }
208+
209+ private static boolean isRequestBodyError (Throwable e ) {
210+ return e .getClass ().getName ().contains ("RestSerializationException" );
211+ }
212+
213+ private static boolean isClientUnknownError (Throwable e ) {
214+ return e .getClass ().getName ().toLowerCase ().contains ("unknown" );
215+ }
211216}
0 commit comments