Tweak error handling to accept both raw strings and errcodes.