Moved error message to top of canonical_color function.