Skip to content

Commit 70c68e1

Browse files
author
Krish
committed
update error type
1 parent ad89a75 commit 70c68e1

4 files changed

Lines changed: 21 additions & 14 deletions

File tree

src/main/java/software/amazon/awssdk/crt/CRT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ private static native void awsCrtInit(int memoryTracingLevel, boolean debugWait,
495495
* function call
496496
* @return The corresponding SdkErrorType for the error code
497497
*/
498-
public static native ErrorType awsGetSdkErrorType(int errorCode);
498+
public static native ErrorType awsGetErrorType(int errorCode);
499499

500500
/**
501501
* @return The number of bytes allocated in native resources. If
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
package software.amazon.awssdk.crt;
22

33
public enum ErrorType {
4-
SUCCESS,
5-
THROTTLING,
6-
SERVER_ERROR,
7-
CONFIGURED_TIMEOUT,
8-
IO,
9-
OTHER
4+
SUCCESS("Success"),
5+
OTHER("Other"),
6+
THROTTLING("Throttling"),
7+
SERVER_ERROR("ServerError"),
8+
CONFIGURED_TIMEOUT("ConfiguredTimeout"),
9+
IO("IO"),
10+
;
11+
12+
public final String name;
13+
14+
ErrorType(String name) {
15+
this.name = name;
16+
}
1017
}

src/main/java/software/amazon/awssdk/crt/s3/S3RequestMetrics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public long getBackoffDelayDurationNs() {
9292
}
9393

9494
public ErrorType getErrorType() {
95-
return CRT.awsGetSdkErrorType(this.errorCode);
95+
return CRT.awsGetErrorType(this.errorCode);
9696
}
9797

9898
public long getServiceCallDurationNs() {

src/native/crt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,20 +619,20 @@ static jobject s_get_error_type_enum(JNIEnv *env, int error_code) {
619619
ordinal = 0; // SUCCESS
620620
break;
621621
case AWS_ERROR_S3_SLOW_DOWN:
622-
ordinal = 1; // THROTTLING
622+
ordinal = 2; // THROTTLING
623623
break;
624624
case AWS_ERROR_S3_INTERNAL_ERROR:
625625
case AWS_ERROR_S3_INVALID_RESPONSE_STATUS:
626626
case AWS_ERROR_S3_REQUEST_TIME_TOO_SKEWED:
627627
case AWS_ERROR_S3_NON_RECOVERABLE_ASYNC_ERROR:
628-
ordinal = 2; // SERVER_ERROR
628+
ordinal = 3; // SERVER_ERROR
629629
break;
630630
case AWS_ERROR_HTTP_RESPONSE_FIRST_BYTE_TIMEOUT:
631631
case AWS_ERROR_HTTP_CONNECTION_MANAGER_ACQUISITION_TIMEOUT:
632632
case AWS_ERROR_S3_REQUEST_TIMEOUT:
633633
case AWS_IO_SOCKET_TIMEOUT:
634634
case AWS_IO_TLS_NEGOTIATION_TIMEOUT:
635-
ordinal = 3; // CONFIGURED_TIMEOUT
635+
ordinal = 4; // CONFIGURED_TIMEOUT
636636
break;
637637
case AWS_ERROR_HTTP_CONNECTION_CLOSED:
638638
case AWS_ERROR_HTTP_CONNECTION_MANAGER_SHUTTING_DOWN:
@@ -641,10 +641,10 @@ static jobject s_get_error_type_enum(JNIEnv *env, int error_code) {
641641
case AWS_ERROR_HTTP_SERVER_CLOSED:
642642
case AWS_ERROR_HTTP_GOAWAY_RECEIVED:
643643
case AWS_ERROR_HTTP_RST_STREAM_RECEIVED:
644-
ordinal = 4; // IO
644+
ordinal = 5; // IO
645645
break;
646646
default:
647-
ordinal = 5; // OTHER
647+
ordinal = 1; // OTHER
648648
break;
649649
}
650650

@@ -749,7 +749,7 @@ jstring JNICALL Java_software_amazon_awssdk_crt_CRT_awsErrorName(JNIEnv *env, jc
749749

750750
JNIEXPORT
751751
jobject JNICALL
752-
Java_software_amazon_awssdk_crt_CRT_awsGetSdkErrorType(JNIEnv *env, jclass jni_crt_class, jint error_code) {
752+
Java_software_amazon_awssdk_crt_CRT_awsGetErrorType(JNIEnv *env, jclass jni_crt_class, jint error_code) {
753753
(void)jni_crt_class;
754754
jobject error_type = s_get_error_type_enum(env, error_code);
755755
return error_type;

0 commit comments

Comments
 (0)