// or it's a property that can throw an error Object.defineProperty(window, "myVariable", { get: function() { throw new Error("W00t?"); }, set: undefined }); if (myVariable) { // Error: W00t? }
/** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * <p/> * "Internal Error : Please file a bug report .... " * <p/> * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); }
/** * {@inheritDoc} */ public final void printPartialStackTrace(PrintWriter out) { super.printStackTrace(out); } }
if ( !(this instanceof arguments.callee) ) throw new Error("Constructor called as a function");
/** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); }
function stackTrace() { var err = new Error(); return err.stack; }
/** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); }
@Override protected void doFinishConnect() throws Exception { throw new Error(); }
/** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); }
function assert(condition, message) { if (!condition) { message = message || "Assertion failed"; if (typeof Error !== "undefined") { throw new Error(message); } throw message; // Fallback } }
/** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); }
private Component findIt(int offset) { for (int low = 0, high = componentCount; low <= high;) { int mid = low + high >>> 1; Component c = components[mid]; if (offset >= c.endOffset) { low = mid + 1; } else if (offset < c.offset) { high = mid - 1; } else { lastAccessed = c; return c; } } throw new Error("should not reach here"); }
/** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); }
var stack = new Error().stack console.log( stack )
/** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); }
private static Level toLevel(InternalLogLevel level) { switch (level) { case INFO: return Level.INFO; case DEBUG: return Level.DEBUG; case WARN: return Level.WARN; case ERROR: return Level.ERROR; case TRACE: return Level.TRACE; default: throw new Error(); } } }
/** * {@inheritDoc} */ public String getMessage(int index) { if (index == 0) { return super.getMessage(); } return delegate.getMessage(index); }
static int wrapperOverhead(ZlibWrapper wrapper) { int overhead; switch (wrapper) { case NONE: overhead = 0; break; case ZLIB: case ZLIB_OR_NONE: overhead = 2; break; case GZIP: overhead = 10; break; default: throw new Error(); } return overhead; }
@Override public String getMessage() { return String.format("[%s] %s", errorCode.name(), super.getMessage()); } }