Skip to content

Commit 4ae3ee0

Browse files
committed
Switch error to DocumentTooLargeError
1 parent 95ed2f7 commit 4ae3ee0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Sources/MongoSwift/BSON/BSONDocument.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ extension BSONDocument {
229229
}
230230
}
231231
guard success else {
232-
throw BSONError.InternalError(
232+
throw BSONError.DocumentTooLargeError(
233233
message: "Failed to merge \(doc) with \(self). This is likely due to " +
234234
"the merged document being too large."
235235
)

Sources/MongoSwift/BSON/BSONError.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public enum BSONError {
3838
"Failed to set value for key \(forKey) to \(value) with" +
3939
" BSON type \(value.bsonType): document too large"
4040
}
41+
42+
internal init(message: String) {
43+
self.message = message
44+
}
4145
}
4246
}
4347

0 commit comments

Comments
 (0)