AWS Code Sample
Catalog demonstrates how to try to delete a job and catch an error.

/* * Copyright 2010-2019, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ try { DeleteJobRequest request = new DeleteJobRequest(jobId); DeleteJobResult result = ET.deleteJob(request); System.out.println("Result: " + result); // Get error information from the service while trying to run the operation } catch (AmazonServiceException ase) { System.err.println("Failed to delete job " + jobId); // Get specific error information System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); // Get information in case the operation is not successful for other reasons } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means"+ " the client encountered " + "an internal error while trying to " + "communicate with Elastic Transcoder, " + "such as not being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); }

Sample Details

Service: elastictranscoder

Author: AWS

Type: snippet

On this page: