api/util/json: set HTTP status and body in JSONAPIErr on error