mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 14:25:52 +00:00
Rework XPCOMException
Original committer: pedemont%us.ibm.com Original revision: 1.4 Original date: 2004/12/22 22:03:50
This commit is contained in:
parent
ab9d5178aa
commit
c84d89f0cd
@ -37,27 +37,58 @@
|
||||
|
||||
package org.mozilla.xpcom;
|
||||
|
||||
import java.lang.*;
|
||||
|
||||
|
||||
/**
|
||||
* This exception is thrown whenever an internal XPCOM/Gecko error occurs.
|
||||
* The internal Mozilla error ID is contained in the message.
|
||||
* You can query the error ID returned by XPCOM by checking
|
||||
* <code>errorcode</code> field.
|
||||
*/
|
||||
public final class XPCOMException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Constructs a new XPCOMException instance.
|
||||
* The XPCOM error value.
|
||||
*/
|
||||
public long errorcode;
|
||||
|
||||
/**
|
||||
* Constructs a new XPCOMException instance, with a default error
|
||||
* (NS_ERROR_FAILURE) and message.
|
||||
*/
|
||||
public XPCOMException() {
|
||||
super();
|
||||
this(0x80004005L, "Unspecified internal XPCOM error");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new XPCOMException instance.
|
||||
* Constructs a new XPCOMException instance with the given message, passing
|
||||
* NS_ERROR_FAILURE as the error code.
|
||||
*
|
||||
* @param message detailed message of exception
|
||||
* @param message detailed message of exception
|
||||
*/
|
||||
public XPCOMException(String message) {
|
||||
super(message);
|
||||
this(0x80004005L, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new XPCOMException instance with the given code, passing
|
||||
* a default message.
|
||||
*
|
||||
* @param code internal XPCOM error ID
|
||||
*/
|
||||
public XPCOMException(long code) {
|
||||
this(code, "Internal XPCOM error");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new XPCOMException instance with an error code and message.
|
||||
*
|
||||
* @param code internal XPCOM error ID
|
||||
* @param message detailed message of exception
|
||||
*/
|
||||
public XPCOMException(long code, String message) {
|
||||
super(message + " (0x" + Long.toHexString(code) + ")");
|
||||
this.errorcode = code;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user