JavaScript275 Documents

Caught Error Name

In try/catch statements, always name the caught error variable e.

Correct

try {
    await saveItem()
}
catch (e) {
    serverError(e)
}

Incorrect

try {
    await saveItem()
}
catch (error) {
    serverError(error)
}

Fix

Rename the caught error binding to e and update every reference within the catch block.