tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RemoteError.sys.mjs (823B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 /**
      6 * Base class for all remote protocol errors.
      7 */
      8 export class RemoteError extends Error {
      9  get isRemoteError() {
     10    return true;
     11  }
     12 
     13  /**
     14   * Convert to a serializable object. Should be implemented by subclasses.
     15   */
     16  toJSON() {
     17    throw new Error("Not implemented");
     18  }
     19 }
     20 
     21 /**
     22 * Internal class for navigation errors.
     23 */
     24 export class NavigationError extends Error {
     25  #status;
     26 
     27  constructor(errorName, status) {
     28    super(errorName);
     29    this.#status = status;
     30  }
     31 
     32  get isNavigationError() {
     33    return true;
     34  }
     35 
     36  get isBindingAborted() {
     37    return this.#status == Cr.NS_BINDING_ABORTED;
     38  }
     39 }