View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.config;
8   
9   import org.mule.api.config.ExceptionReader;
10  
11  import java.util.HashMap;
12  import java.util.Map;
13  
14  /**
15   * This is the default exception reader used if there is no specific one registered
16   * for the current exception.
17   */
18  public final class DefaultExceptionReader implements ExceptionReader
19  {
20  
21      private Map<?, ?> info = new HashMap<Object, Object>();
22  
23      public String getMessage(Throwable t)
24      {
25          return t.getMessage();
26      }
27  
28      public Throwable getCause(Throwable t)
29      {
30          return t.getCause();
31      }
32  
33      public Class<?> getExceptionType()
34      {
35          return Throwable.class;
36      }
37  
38      /**
39       * Returns a map of the non-stanard information stored on the exception
40       * 
41       * @return a map of the non-stanard information stored on the exception
42       */
43      public Map<?, ?> getInfo(Throwable t)
44      {
45          return info;
46      }
47  }