Or it returns an error if something bad happens. However at times, after saving a document, it is desirable to only know that the operation was successful if no further operations to the document are required. Right now I do something this like this:
SavedDoc = couchbeam_db:save_doc(Doc),
% do some validation on the doc itself like checking
% the ID to see if the save was OK
Id = couchbeam_doc:get_id(SavedDoc), % crash here on error
ExpectedId = Id % or crash here
What would be nice is if all operations would return something like:
Currently when saving a document, couchbeam returns the saved document directly:
Or it returns an error if something bad happens. However at times, after saving a document, it is desirable to only know that the operation was successful if no further operations to the document are required. Right now I do something this like this:
What would be nice is if all operations would return something like:
so that validations could be done like:
In this case we'd crash immediately if an error occurred, and it's a lot more straightforward to verify if an operation was successful or not.