Skip to content

CopyObjectAsync method throws AmazonS3Exception when source object doesn't exist. #2996

Discussion options

You must be logged in to vote

@olizarevichroman Good morning. Thanks for reporting the concern. The behavior to throw an exception is as per design. The behavior is also controlled by service models which may define what exceptions a particular service operation may throw (for example NoSuchKey). This behavior is uniform across all AWS SDK(s) and is unlikely to change.

For your use case, you may develop a middleware with POCO object for each service operation that could have a shape with members like StatusCode and <ServiceOperation>Response object, where your middleware would catch specific exceptions and returns POCO object with specified status code to the caller.

I'm converting this to Q&A discussion since the beh…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@olizarevichroman
Comment options

@ashishdhingra
Comment options

Answer selected by ashishdhingra
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #2995 on July 11, 2023 16:40.