@@ -111,7 +111,12 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
111111 logger .info ("Upload the following CSV data to the {} S3 bucket." , glueBucketName );
112112 logger .info (csv );
113113 waitForInputToContinue (scanner );
114- actions .uploadInputData (glueBucketName , json , csv );
114+ try {
115+ actions .uploadInputData (glueBucketName , json , csv );
116+ } catch (CompletionException ce ) {
117+ Throwable cause = ce .getCause ();
118+ logger .error ("Failed to create JSON schema mapping: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
119+ }
115120 logger .info ("The JSON objects have been uploaded to the S3 bucket." );
116121 waitForInputToContinue (scanner );
117122 logger .info (DASHES );
@@ -135,7 +140,7 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
135140 logger .info ("The JSON schema mapping name is " + jsonSchemaMappingName );
136141 } catch (CompletionException ce ) {
137142 Throwable cause = ce .getCause ();
138- logger .info ("Failed to create JSON schema mapping: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
143+ logger .error ("Failed to create JSON schema mapping: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
139144 }
140145
141146 try {
@@ -144,7 +149,7 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
144149 logger .info ("The CSV schema mapping name is " + csvSchemaMappingName );
145150 } catch (CompletionException ce ) {
146151 Throwable cause = ce .getCause ();
147- logger .info ("Failed to create CSV schema mapping: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
152+ logger .error ("Failed to create CSV schema mapping: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
148153 }
149154 waitForInputToContinue (scanner );
150155 logger .info (DASHES );
@@ -168,7 +173,8 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
168173 logger .info ("The workflow ARN is: " + workflowArn );
169174 } catch (CompletionException ce ) {
170175 Throwable cause = ce .getCause ();
171- logger .info ("Failed to create workflow: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
176+ logger .error ("Failed to create workflow: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
177+ return ;
172178 }
173179 waitForInputToContinue (scanner );
174180
@@ -181,7 +187,8 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
181187 logger .info ("The matching job was successfully started." );
182188 } catch (CompletionException ce ) {
183189 Throwable cause = ce .getCause ();
184- logger .info ("Failed to start matching job: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
190+ logger .error ("Failed to start matching job: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
191+ return ;
185192 }
186193 waitForInputToContinue (scanner );
187194 logger .info (DASHES );
@@ -193,7 +200,8 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
193200 actions .getMatchingJobAsync (jobId , workflowName ).join ();
194201 } catch (CompletionException ce ) {
195202 Throwable cause = ce .getCause ();
196- logger .info ("Failed to start matching job: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
203+ logger .error ("Failed to start matching job: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
204+ return ;
197205 }
198206 logger .info (DASHES );
199207
@@ -205,14 +213,20 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
205213 jsonSchemaMappingArn = response .schemaArn ();
206214 logger .info ("Schema mapping ARN is " + jsonSchemaMappingArn );
207215 } catch (CompletionException ce ) {
208- logger .info ("Error retrieving schema mapping: " + ce .getCause ().getMessage ());
216+ logger .error ("Error retrieving the specific schema mapping: " + ce .getCause ().getMessage ());
217+ return ;
209218 }
210219 waitForInputToContinue (scanner );
211220 logger .info (DASHES );
212221
213222 logger .info (DASHES );
214223 logger .info ("6. List Schema Mappings." );
215- actions .ListSchemaMappings ();
224+ try {
225+ actions .ListSchemaMappings ();
226+ } catch (CompletionException ce ) {
227+ logger .error ("Error retrieving schema mapping: " + ce .getCause ().getMessage ());
228+ return ;
229+ }
216230 waitForInputToContinue (scanner );
217231 logger .info (DASHES );
218232
@@ -225,7 +239,13 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
225239 In Entity Resolution, SchemaMapping and MatchingWorkflow can be tagged. For this example,
226240 the SchemaMapping is tagged.
227241 """ );
228- actions .tagEntityResource (jsonSchemaMappingArn ).join ();
242+ try {
243+ actions .tagEntityResource (jsonSchemaMappingArn ).join ();
244+ } catch (CompletionException ce ) {
245+ logger .error ("Error tagging the resource: " + ce .getCause ().getMessage ());
246+ return ;
247+ }
248+
229249 waitForInputToContinue (scanner );
230250 logger .info (DASHES );
231251
@@ -280,6 +300,7 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
280300 } catch (CompletionException ce ) {
281301 Throwable cause = ce .getCause ();
282302 logger .info ("Failed to delete workflow: " + (cause != null ? cause .getMessage () : ce .getMessage ()));
303+ return ;
283304 }
284305
285306 try {
@@ -289,6 +310,7 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
289310 logger .info ("Both schema mappings were deleted successfully!" );
290311 } catch (RuntimeException e ) {
291312 logger .error ("Error deleting schema mapping: {}" , e .getMessage ());
313+ return ;
292314 }
293315
294316 waitForInputToContinue (scanner );
@@ -304,6 +326,7 @@ Amazon Web Services (AWS) that helps organizations extract, link, and
304326 } catch (CompletionException ce ) {
305327 Throwable cause = ce .getCause ();
306328 logger .error ("Failed to delete Glue Table: {}" , cause != null ? cause .getMessage () : ce .getMessage ());
329+ return ;
307330 }
308331
309332 } else {
0 commit comments