Use only the built-in Error object

    Code Example – doing it right

    Code example – doing it even better

    Javascript

    Typescript

    Explanation about the in Typescript: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget

    Blog Quote: “A string is not an error”

    From the blog, devthought.com ranked 6 for the keywords “Node.js error object”

    Blog Quote: “All JavaScript and System errors raised by Node.js inherit from Error”

    From Node.js official documentation