1 package org.opensync.engine.server;
2
3 import org.opensync.engine.util.I18n;
4
5 /***
6 * This object represent a functionnal exception
7 *
8 */
9
10 public class OpenSyncException extends Exception {
11
12 /***
13 * Construct a OpenSyncExcdeption
14 *
15 * @param msg the message of the exception
16 */
17 public OpenSyncException(String msg) {
18 super(msg);
19 }
20 /***
21 * Construct a OpenSyncExcdeption
22 *
23 * @param msgKey the message key of the exception
24 * @param params the parameters used to format the message
25 */
26 public OpenSyncException(String msgKey,Object[]params) {
27 super(formatMsgKey(msgKey,params));
28 }
29 /***
30 * A format helper function
31 *
32 * @param msgKey the message key of the exception
33 * @param params the parameters used to format the message
34 */
35 static public String formatMsgKey(String msgKey,Object[]params){
36 if(params == null){
37 return I18n.getInstance().get(msgKey);
38 }
39 else{
40 return I18n.getInstance().format(msgKey,params);
41 }
42 }
43 }