| ▲ | aw1621107 an hour ago | |
> In both cases getting no owner should suffice? Depends on what exactly you plan on doing with the information, I'd imagine. I don't think it's necessarily a given that "no document" and "no owner" should be handled identically (e.g., searching for the updated document to try again vs. returning an operation-not-allowed error). > Why are you using get_owner to try and figure out if the document exists? Potential TOCTOU issues, perhaps? As I mentioned the document could have vanished out from under you so detecting this situation could let handle things appropriately (though to be fair that argument could probably extend to future operations as well). Maybe a versioned filesystem would have made a bit more sense, where None would indicate a new version is available? Another example I've seen mentioned is trying to get a key-value pair from a JSON where the key may be missing. But in any case, I did say it was a bit of a contrived example, so cut me a bit of slack :P It was just the first thing that came to mind. The examples sibling comments give are probably more practical. | ||
| ▲ | what 3 minutes ago | parent [-] | |
> I don't think it's necessarily a given that "no document" and "no owner" should be handled identically (e.g., searching for the updated document to try again vs. returning an operation-not-allowed error). If you care whether a document exists or not, you should use an API that exclusively tells you that instead of expecting everything related to documents telling you if the document exists or not. | ||