[Solved] throw 'my error' vs throw new Error('error')

Which one should I use and why?

Code:
throw 'my error';throw new Error('my error');
Errors are handled like this:

SceneManager.onError = function(e) {    console.error(e.message);    console.error(e.filename, e.lineno);    try {        this.stop();        Graphics.printError('Error', e.message);        AudioManager.stopAll();    } catch (e2) {    }};Since that code assumes, that the error is an object and not a simple String, i'm inclined to say that the 2nd approach is correct. However, if both work for you (because the thrown String gets autoboxed), i don't see any real advantage or disadvantage.
Some browsers didn't work correctly with the string option. The error object can also hold more information other than the message itself.
Also, they way both messages are shown on the console is different.:

throw new Error('string') shows on the console the sources of the error.

HGWdMpH.png


throw "string' just points to SceneManager.onError.

cwDlpiJ.png
So the object clearly wins. Thanks all.

Original thread: https://forums.rpgmakerweb.com/threads/solved-throw-my-error-vs-throw-new-error-error.52959/