API service global error handler