Refactor a chain of calls into two lines (for better error reporting).

Signed-off-by: Daira Hopwood <daira@leastauthority.com>