• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 package software.amazon.awssdk.crt.http;
7 
8 import software.amazon.awssdk.crt.CRT;
9 
10 /**
11  * This exception will be thrown by any exceptional cases encountered within the
12  * JNI bindings to the AWS Common Runtime
13  */
14 public class HttpException extends RuntimeException {
15     private final int errorCode;
16 
17     /**
18      * Constructs a new HttpException
19      * @param errorCode native error code representing the error source/reason
20      */
HttpException(int errorCode)21     public HttpException(int errorCode) {
22         super(CRT.awsErrorString(errorCode));
23         this.errorCode = errorCode;
24     }
25 
26     /**
27      * Returns the error code captured when the exception occurred. This can be fed to CRT.awsErrorString() to
28      * get a user-friendly error string
29      * @return The error code associated with this exception
30      */
getErrorCode()31     public int getErrorCode() {
32         return errorCode;
33     }
34 }
35