Implement catogirized error codes in a backward-compatibility way