Add proper error handling for the S3 provider

Closes #99