Commit bb15cd61 authored by Lubomir Bulej's avatar Lubomir Bulej

Unify exception interfaces

parent 761eee97
...@@ -14,13 +14,15 @@ class RequestErrorException extends Throwable { ...@@ -14,13 +14,15 @@ class RequestErrorException extends Throwable {
} }
RequestErrorException (final String message, final Throwable throwable) { RequestErrorException (final String format, final Object... args) {
super (message, throwable); super (String.format (format, args));
} }
RequestErrorException (final String format, final Object... args) { RequestErrorException (
super (String.format (format, args)); final Throwable cause, final String format, final Object... args
) {
super (String.format (format, args), cause);
} }
} }
package ch.usi.dag.server; package ch.usi.dag.server;
/** /**
* Represents exceptions thrown when server initialization fails. * An exception thrown when server initialization fails, i.e., before it starts
* accepting connections from clients.
* *
* @author Vit Kabele <vit@kabele.me> * @author Vit Kabele <vit@kabele.me>
*/ */
...@@ -13,11 +14,6 @@ final class ServerInitializationException extends Exception { ...@@ -13,11 +14,6 @@ final class ServerInitializationException extends Exception {
} }
ServerInitializationException (final String message, final Throwable throwable) {
super (message, throwable);
}
ServerInitializationException (final String format, final Object... args) { ServerInitializationException (final String format, final Object... args) {
super (String.format (format, args)); super (String.format (format, args));
} }
......
package ch.usi.dag.server; package ch.usi.dag.server;
/** /**
* Represents exceptions thrown when server fails at runtime. * An exception thrown when an internal server error occurs during. These do not
* necessarily reach the client.
* *
* @author Vit Kabele <vit@kabele.me> * @author Vit Kabele <vit@kabele.me>
*/ */
...@@ -18,8 +19,10 @@ class ServerRuntimeException extends Throwable { ...@@ -18,8 +19,10 @@ class ServerRuntimeException extends Throwable {
} }
ServerRuntimeException (final String message, final Throwable e) { ServerRuntimeException (
super (message, e); final Throwable cause, final String format, final Object... args
) {
super (String.format (format, args), cause);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment