001: /* XelException.java
002:
003: {{IS_NOTE
004: Purpose:
005:
006: Description:
007:
008: History:
009: Thu Aug 30 10:06:53 2007, Created by tomyeh
010: }}IS_NOTE
011:
012: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
013:
014: {{IS_RIGHT
015: This program is distributed under GPL Version 2.0 in the hope that
016: it will be useful, but WITHOUT ANY WARRANTY.
017: }}IS_RIGHT
018: */
019: package org.zkoss.xel;
020:
021: import org.zkoss.lang.SystemException;
022: import org.zkoss.lang.Exceptions;
023:
024: /**
025: * Represents a XEL exception.
026: *
027: * @author tomyeh
028: * @since 3.0.0
029: */
030: public class XelException extends SystemException {
031: /** Utilities.
032: *
033: * <p>The reason to use a class to hold static utilities is we can
034: * override the method's return type later.
035: */
036: public static class Aide {
037: /** Converts an exception to XelException if it is
038: * not RuntimeException nor Error.
039: * @see Exceptions#wrap
040: */
041: public static XelException wrap(Throwable t) {
042: return (XelException) Exceptions
043: .wrap(t, XelException.class);
044: }
045:
046: /** Converts an exception to XelException if it is
047: * not RuntimeException nor Error.
048: * @see Exceptions#wrap
049: */
050: public static XelException wrap(Throwable t, String msg) {
051: return (XelException) Exceptions.wrap(t,
052: XelException.class, msg);
053: }
054:
055: /** Converts an exception to XelException if it is
056: * not RuntimeException nor Error.
057: * @see Exceptions#wrap
058: */
059: public static XelException wrap(Throwable t, int code,
060: Object[] fmtArgs) {
061: return (XelException) Exceptions.wrap(t,
062: XelException.class, code, fmtArgs);
063: }
064:
065: /** Converts an exception to XelException if it is
066: * not RuntimeException nor Error.
067: * @see Exceptions#wrap
068: */
069: public static XelException wrap(Throwable t, int code,
070: Object fmtArg) {
071: return (XelException) Exceptions.wrap(t,
072: XelException.class, code, fmtArg);
073: }
074:
075: /** Converts an exception to XelException if it is
076: * not RuntimeException nor Error.
077: * @see Exceptions#wrap
078: */
079: public static XelException wrap(Throwable t, int code) {
080: return (XelException) Exceptions.wrap(t,
081: XelException.class, code);
082: }
083: }
084:
085: public XelException(String msg, Throwable cause) {
086: super (msg, cause);
087: }
088:
089: public XelException(String s) {
090: super (s);
091: }
092:
093: public XelException(Throwable cause) {
094: super (cause);
095: }
096:
097: public XelException() {
098: }
099:
100: public XelException(int code, Object[] fmtArgs, Throwable cause) {
101: super (code, fmtArgs, cause);
102: }
103:
104: public XelException(int code, Object fmtArg, Throwable cause) {
105: super (code, fmtArg, cause);
106: }
107:
108: public XelException(int code, Object[] fmtArgs) {
109: super (code, fmtArgs);
110: }
111:
112: public XelException(int code, Object fmtArg) {
113: super (code, fmtArg);
114: }
115:
116: public XelException(int code, Throwable cause) {
117: super (code, cause);
118: }
119:
120: public XelException(int code) {
121: super(code);
122: }
123: }
|