Restructure: API - set up custom error handlers.