Move error-related stuff into its own file and merge with color
Merge pull request #3931 from yebblies/errors

[refactor] Move error-related stuff into its own file and merge with color