Error handler for pure-JSON apps