S3 - Check for code attr before using in error message
Merge pull request #7123 from techhat/s3assump

S3 - Check for code attr before using in error message