api/util/json: improved logging of server errors