add error handler to api router