Unify and fixup error handling