update error handling for Mojo 5.x