Skip navigation links

Package net.sf.mmm.util.exception.api

Provides the API for utilities that help to deal with exceptions.

See: Description

Package net.sf.mmm.util.exception.api Description

Provides the API for utilities that help to deal with exceptions.

Util Exception API

This package contains the advanced exceptions with support for NLS (I18N/L10N), UUIDs, error codes, etc. - especially NlsRuntimeException. Further it contains various exceptions for common errors that can be reused. Finally, it contains the API of utilities that help to deal with exceptions especially ExceptionUtil.

Custom Exception Example:

 public class InvalidCustomerNumberException extends NlsRuntimeException {
   public InvalidCustomerNumberException(String customerNumber) {
     super(createBundle(MyNlsBundleRoot.class).errorInvalidCustomerNumber(customerNumber);
   }

   public getCode() { // optional method
     return "CUST0001"; // maybe use a constant
   }
 }
 
For native language support (NLS) you create an NlsBundle typically per module:
 public interface MyNlsBundleRoot extends NlsBundle {

    @NlsBundleMessage("The given customer number \"{id}\" is invalid!")
   NlsMessage errorInvalidCustomerNumber(@Named("id") String id);
 }
 
For further details about the NLS and I18N please read the NLS API documentation.
Skip navigation links

Copyright © 2001–2014 mmm-Team. All rights reserved.