File tree Expand file tree Collapse file tree
src/Serilog.Sinks.MongoDB/Helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,9 +58,7 @@ internal static void VerifyCollectionExists(
5858 {
5959 database . CreateCollection ( collectionName , collectionCreationOptions ) ;
6060 }
61- catch ( MongoCommandException e ) when ( e . ErrorMessage . Contains (
62- "collection already exists" ,
63- StringComparison . InvariantCultureIgnoreCase ) )
61+ catch ( MongoCommandException e ) when ( e . CodeName == "NamespaceExists" )
6462 {
6563 // handled
6664 }
@@ -89,8 +87,7 @@ internal static void VerifyExpireTTLSetup(
8987
9088 return ;
9189 }
92- catch ( MongoCommandException ex ) when ( ex . ErrorMessage . Contains (
93- "already exists with different options" ) )
90+ catch ( MongoCommandException ex ) when ( ex . CodeName == "IndexOptionsConflict" )
9491 {
9592 // handled -- just drop and recreate
9693 logCollection . Indexes . DropOne ( ExpireTTLIndexName ) ;
You can’t perform that action at this time.
0 commit comments