add error codes to logging