JAVA UTIL EXCEPTION

back to JAVA projects back to JAVA util projects

description
The aim of this project is to provide extended implementations of the basic exception classes (Exception and RuntimeException). The main goal is to get rid of exception instanceof to detect what happened (or worse, like error message parsing ...). The additional functionalities are :


 * an identifier enables to clearly identify the error
 * additional data can be used for the default error message or retrieved for error handling :
 * the creation time
 * an optional collection of user-defined parameters

[TODO] add more details about each feature

example of use
Here's a basic example using ParametricException for a file copy service. The first thing to do is to define the error identifiers. In this case :

public static enum FileCopyError implements ErrorIdentifier { SERVICE_UNAVAILABLE("The service is not available."), COPY_FAILED("Failed to copy file from [{}] to [{}]."); private final String defaultMessage; private FileCopyError(final String defaultMessage) { this.defaultMessage = defaultMessage; }  @Override public String getDefaultMessage { return defaultMessage; } }

[TODO] finish example to cover all features

versions

 * 0.3.1 2014/08/31
 * updated source/target version for java 8
 * update SLF4J version to 1.7.7
 * removed JSR 310 RI dependency
 * 0.3.0 2013/05/27
 * added basic tests
 * use UTC time zone if system default timezone is unknown
 * fixed NPE thrown when getParameters is called on an exception with no parameters
 * 0.2.1 2013/05/01
 * fixed wrong parameters assignment
 * changed getParameters to return a copy of the actual paramters array
 * 0.2.0 2013/04/21
 * updated slf4j version to 1.7.5
 * added creation time for ParametricException and ParametricRuntimeException
 * 0.1 2012/08/30 first usable version

dependencies

 * SLF4J API 1.7.7 for default messages format

next version

 * 0.4
 * TODO
 * add javadoc, tests

back to JAVA util projects back to JAVA projects