-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of ResourceNotFoundException #34
Comments
TL;DR thats because the semantics of UpdateItem are such that it is valid for it to work if the item is not present (no, the tests dont convey that)
The GetItem API handles item not found by having the response have That sort of thing is covered by the default TableContext.Create having Your choices are:
The AWS SDK's A condition check failure is handled as an Exception, there is no other way, and you do not get to see the original state if it fails If you do A Sounds like what you're after is either an optimistic UpdateItem guarded by an exists precondition, or something like:
(Or simply use Let me know if you have follow-up questions |
Hm I note with interest that the The xmldoc for
Changing the exception would obviously be a breaking change that's hard to argue for at this stage (the real fix is to use |
Thanks @bartelink, that does clarify.
This is a nice surprise too! |
I notice that
UpdateItemAsync
doesn't handle400: ResourceNotFoundException
s and subsequently returns a'TRecord
, not a'TRecord option
. I have a scenario where I want to use anUpdateIfExists
kind of function so I can achieve something in one request, not two. In my case, it wouldn't be particularly exceptional that it sometimes doesn't exist.Is there a design reason why handling of ResourceNotFoundException isn't part of this library that I should be aware of? Why I might want to avoid that approach? (I'm new to DynamoDB...)
FSharp.AWS.DynamoDB/src/FSharp.AWS.DynamoDB/TableContext.fs
Lines 277 to 299 in 89ed43f
The text was updated successfully, but these errors were encountered: