Skip to content

Error Handling

Alex edited this page Aug 12, 2018 · 2 revisions

Throw a new error is pretty easy

import sendError from "../util/error";

[...]

app.get("/", (req, res) => {
    do.myWork().then(() => {
        // Handle something
    }).catch((err) => {
        sendError(req, res, err); // Send the Error
    });
});

This will show a 500 page and if the hostname is localhost:3000 or dev.savetheinternet.info it will show the error message

Clone this wiki locally