Extract error related structs and funcs into errorutils

This is the second of a few pull requests to break up utils into more discrete packages (#7222 is the first). My team needs this so we can import packages from Docker without inadvertently inheriting all the imports from utils.