BAMPFA-79: Improve error handling.