11import com .sendgrid .*;
22import java .io .OutputStream ;
33import java .io .IOException ;
4+ import java .net .URISyntaxException ;
45import java .util .HashMap ;
56import java .util .Map ;
67import com .fasterxml .jackson .databind .ObjectMapper ;
78import com .fasterxml .jackson .databind .JsonNode ;
89
910public class Example
1011{
11- public static void main (String [] args ) {
12+ public static void main (String [] args ) throws IOException {
1213 Client client = new Client ();
1314
1415 Request request = new Request ();
@@ -33,7 +34,7 @@ public static void main(String[] args) {
3334 System .out .println (response .responseBody );
3435 System .out .println (response .responseHeaders );
3536 }catch (IOException ex ){
36- ex . printStackTrace () ;
37+ throw ex ;
3738 }
3839 request .queryParams = null ;
3940
@@ -47,15 +48,15 @@ public static void main(String[] args) {
4748 System .out .println (response .responseBody );
4849 System .out .println (response .responseHeaders );
4950 }catch (IOException ex ){
50- ex . printStackTrace () ;
51+ throw ex ;
5152 }
5253 String apiKeyID = "" ;
5354 try {
5455 ObjectMapper mapper = new ObjectMapper ();
5556 JsonNode json = mapper .readTree (response .responseBody );
5657 apiKeyID = json .path ("api_key_id" ).asText ();
5758 }catch (IOException ex ){
58- System . out . println ( ex . toString ()) ;
59+ throw ex ;
5960 }
6061 request .requestBody = "" ;
6162
@@ -68,7 +69,7 @@ public static void main(String[] args) {
6869 System .out .println (response .responseBody );
6970 System .out .println (response .responseHeaders );
7071 }catch (IOException ex ){
71- ex . printStackTrace () ;
72+ throw ex ;
7273 }
7374
7475 // PATCH
@@ -80,7 +81,7 @@ public static void main(String[] args) {
8081 System .out .println (response .responseBody );
8182 System .out .println (response .responseHeaders );
8283 }catch (IOException ex ){
83- ex . printStackTrace () ;
84+ throw ex ;
8485 }
8586 request .requestBody = "" ;
8687
@@ -93,7 +94,7 @@ public static void main(String[] args) {
9394 System .out .println (response .responseBody );
9495 System .out .println (response .responseHeaders );
9596 }catch (IOException ex ){
96- ex . printStackTrace () ;
97+ throw ex ;
9798 }
9899 request .requestBody = "" ;
99100
@@ -104,7 +105,7 @@ public static void main(String[] args) {
104105 System .out .println (response .statusCode );
105106 System .out .println (response .responseHeaders );
106107 }catch (IOException ex ){
107- ex . printStackTrace () ;
108+ throw ex ;
108109 }
109110 }
110111}
0 commit comments