add factory method

This commit is contained in:
Volker Berlin 2017-03-19 18:06:53 +01:00
parent bbb9c8c0c9
commit dc1128cb2e

View File

@ -23,4 +23,27 @@ package de.inetsoftware.jwebassembly;
*/
public class CompileException extends Exception {
/**
* Create a new instance with a cause.
*
* @param cause
* the cause
*/
CompileException( Throwable cause ) {
super( cause );
}
/**
* Create a wrapped exception needed.
*
* @param cause
* the wrapped cause
* @return a new instance
*/
public static CompileException create( Throwable cause ) {
if( cause instanceof CompileException ) {
return (CompileException)cause;
}
return new CompileException( cause );
}
}