refactoring error code tests