Log APIErrors more cleanly

This is related to #28.