s3: reworked exception handling