multex
Class MethodFailure

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--multex.Failure
                          |
                          +--multex.MethodFailure

public class MethodFailure
extends Failure

Convenience class, which can be directly used to be thrown by any failed method. It has always the same message: "Failure in operation {methodName} in class {className}". The named exception parameters should be derived automatically from the stack trace (???not yet implemented).

Attention:The usage of this convenience class is comfortable, but not recommended. You would get better user messages by defining individual exceptions with a specific message text for the failure of each method, which can be triggered by user action. For exceptions of the lower tiers this holds the same. You should also consider to define a Failure-exception for each unit (class or package) of the lower tiers. Then it would be easier to catch and handle exceptions from this unit the same way.

See Also:
Serialized Form

Constructor Summary
MethodFailure(java.lang.Exception i_cause)
          Constructs a MethodFailure-exception, giving only the causing Exception object.
MethodFailure(java.lang.Exception i_cause, java.lang.Object[] i_unnamedParameters)
          Constructs a MethodFailure-exception, giving the causing Exception object for providing the diagnostics causer chain and unnamed message parameters as an Object[].
 
Methods inherited from class multex.Failure
cause, cause, getDefaultMessageTextPattern, getMessage, printCompactStackTrace, printStackTrace, printStackTrace, printStackTrace
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodFailure

public MethodFailure(java.lang.Exception i_cause)
Constructs a MethodFailure-exception, giving only the causing Exception object.

MethodFailure

public MethodFailure(java.lang.Exception i_cause,
                     java.lang.Object[] i_unnamedParameters)
Constructs a MethodFailure-exception, giving the causing Exception object for providing the diagnostics causer chain and unnamed message parameters as an Object[]. The preferred way to parameterize a Failure exception is by named parameters, which is described at Failure.Failure(String,Exception) Nevertheless you can shortly create unnamed message parameters by creating an Object[] holding the unnamed parameters, e.g.:

 try{
   ... //many calls to service methods
 } catch(Exception ex){ //all these are unexpected
     throw new MethodFailure(ex, new Object[]{new Integer(i_size), i_element});
   }
 //end try