Define and use error codes