Apex provides debugging support. You can debug your Apex code using the Developer
Console and debug logs.
To aid debugging in your code, Apex supports exception statements and custom exceptions.
Also, Apex sends emails to developers for unhandled exceptions.