Handle errors with JSON messages.