__index__ / ErrorUtils

// ==OpenUserJS==
// @author __index__
// @copyright 2019, __index__ (https://openuserjs.org/users/__index__)
// @license MIT
// ==/OpenUserJS==

// ==UserScript==
// @name         ErrorUtils
// @namespace    http://tampermonkey.net/
// @version      0.8
// @description  Adds some stuff to Error.prototype for easier fixing
// @author       Odd Stranger#7957
// @match        *://*/*
// @grant        none
// @license MIT
// ==/UserScript==
/*
    ===========
     CHANGELOG
    ===========
    0.1:
        Made the script
    0.2:
        Fixed the script
    0.3:
        Actually fixed the script
    0.4:
        You guessed it... another fix attempt
    0.5:
        Bruh
    0.6:
        How do I make the script match all URLs????
    0.7:
        I give up............
    0.8:
        Actually fixed it now x2
*/
/*
    Example usage:
    throw new Error("test").google()
*/
(function() {
    'use strict';
    Error.prototype.google = function(){
        window.open("https://www.google.com/search?q="+encodeURI(this.message));
    };
    Error.prototype.SO = function(){
        window.open("https://stackoverflow.com/search?q=[js] "+this.message.replace(/ /g, "+"));
    };
    Error.prototype.suppress = function(){
        delete(this);
    };
})();