tor-browser

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

Error.js (867B)


      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
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 /* ES6 20140718 draft 19.5.3.4. */
      6 function ErrorToString() {
      7  /* Steps 1-2. */
      8  var obj = this;
      9  if (!IsObject(obj)) {
     10    ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "Error", "toString", "value");
     11  }
     12 
     13  /* Steps 3-5. */
     14  var name = obj.name;
     15  name = name === undefined ? "Error" : ToString(name);
     16 
     17  /* Steps 6-8. */
     18  var msg = obj.message;
     19  msg = msg === undefined ? "" : ToString(msg);
     20 
     21  /* Step 9. */
     22  if (name === "") {
     23    return msg;
     24  }
     25 
     26  /* Step 10. */
     27  if (msg === "") {
     28    return name;
     29  }
     30 
     31  /* Step 11. */
     32  return name + ": " + msg;
     33 }
     34 
     35 function ErrorToStringWithTrailingNewline() {
     36  return FUN_APPLY(ErrorToString, this, []) + "\n";
     37 }