Raise a RuntimeError if we encountered an API error