sixtyfour icon indicating copy to clipboard operation
sixtyfour copied to clipboard

How to do error handling with paws?

Open sckott opened this issue 2 years ago • 1 comments

Some error messages that I've seen thus far in paws are not going to be useful to the typical sixtyfour user. e.g.,

Below, probably users won't be familiar with http status codes, though I know that a 404 means not found, so I can intuit that something wasn't found, but was it the bucket or the key? In addition, the error message is not useful to the user at all.

aws_file_attr(bucket = "s64-test-2", key = "doesntexist")
#> Error: SerializationError (HTTP 404). failed to read from query HTTP response body

Though sometimes the error messages are good:

aws_bucket_list_objects(bucket="s64-test-211")
#> Error: NoSuchBucket (HTTP 404). The specified bucket does not exist

and another good error message

desc_file <- file.path(system.file(), "DESCRIPTION")
aws_file_upload(bucket = "not-a-bucket", path = desc_file)
#> Error: BucketAlreadyExists (HTTP 409). The requested bucket name is not available. 
#> The bucket namespace is shared by all users of the system. Please select a different name and try again.

@seankross just a placeholder to maybe deal with this, any thoughts welcome

sckott avatar Oct 10 '23 23:10 sckott

Where we're doing an operation with files, we could first check if the bucket the file(s) are in exists and give an error message saying so. The error when a bucket doesn't exist I think is usually a 403, which is fine and correct, but isn't helpful to users. We could deal with this by catching the 403 and when it happens telling the user X bucket doesn't exist, or likely doesn't exist at least?

sckott avatar Jul 24 '24 20:07 sckott