Merge pull request #6106 from tristanlins/hotfix/use-error-constant-instead-of-code