Enhance error handling of DocumentCollection.Builder and add tests