1 /* 2 3 Copyright 2001 The Apache Software Foundation 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 17 */ 18 package org.apache.batik.transcoder; 19 20 /** 21 * This interface provides a way to catch errors and warnings from a 22 * Transcoder. 23 * 24 * If an application needs to implement customized error handling, it 25 * must implement this interface and then register an instance with 26 * the Transcoder using the transcoder's setErrorHandler method. The 27 * transcoder will then report all errors and warnings through this 28 * interface. 29 * 30 * A transcoder shall use this interface instead of throwing an 31 * exception: it is up to the application whether to throw an 32 * exception for different types of errors and warnings. Note, 33 * however, that there is no requirement that the transcoder continue 34 * to provide useful information after a call to fatalError (in other 35 * words, a transcoder class could catch an exception and report a 36 * fatalError). 37 * 38 * @author <a HREF="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a> 39 * @version $Id: ErrorHandler.java,v 1.5 2004/08/18 07:15:41 vhardy Exp $ 40 */ 41 public interface ErrorHandler { 42 43 /** 44 * Invoked when an error occured while transcoding. 45 * @param ex the error informations encapsulated in a TranscoderException 46 * @exception TranscoderException if the method want to forward 47 * the exception 48 */ 49 void error(TranscoderException ex) throws TranscoderException; 50 51 /** 52 * Invoked when an fatal error occured while transcoding. 53 * @param ex the fatal error informations encapsulated in a 54 * TranscoderException 55 * @exception TranscoderException if the method want to forward 56 * the exception 57 */ 58 void fatalError(TranscoderException ex) throws TranscoderException; 59 60 /** 61 * Invoked when a warning occured while transcoding. 62 * @param ex the warning informations encapsulated in a TranscoderException 63 * @exception TranscoderException if the method want to forward 64 * the exception 65 */ 66 void warning(TranscoderException ex) throws TranscoderException; 67 68 } 69