Skip to content

Commit 7c832bc

Browse files
author
Roman Janusz
committed
added some missing handleFailures
1 parent 1955cd6 commit 7c832bc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

commons-mongo/jvm/src/main/scala/com/avsystem/commons/mongo/BsonReaderInput.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ class BsonReaderInput(br: BsonReader, override val legacyOptionEncoding: Boolean
2626
override def readInt(): Int =
2727
expect(BsonType.INT32, br.readInt32())
2828

29-
override def readLong(): Long = bsonType match {
30-
case BsonType.INT32 => br.readInt32().toLong
31-
case BsonType.INT64 => br.readInt64()
32-
case _ => wrongType(BsonType.INT32, BsonType.INT64)
29+
override def readLong(): Long = handleFailures {
30+
bsonType match {
31+
case BsonType.INT32 => br.readInt32().toLong
32+
case BsonType.INT64 => br.readInt64()
33+
case _ => wrongType(BsonType.INT32, BsonType.INT64)
34+
}
3335
}
3436

3537
override def readTimestamp(): Long =
@@ -41,12 +43,12 @@ class BsonReaderInput(br: BsonReader, override val legacyOptionEncoding: Boolean
4143
override def readBinary(): Array[Byte] =
4244
expect(BsonType.BINARY, br.readBinaryData().getData)
4345

44-
override def readList(): BsonReaderListInput = {
46+
override def readList(): BsonReaderListInput = handleFailures {
4547
br.readStartArray()
4648
new BsonReaderListInput(new BsonReaderIterator(br, _.readEndArray(), new BsonReaderInput(_, legacyOptionEncoding)))
4749
}
4850

49-
override def readObject(): BsonReaderObjectInput = {
51+
override def readObject(): BsonReaderObjectInput = handleFailures {
5052
br.readStartDocument()
5153
new BsonReaderObjectInput(br, legacyOptionEncoding)
5254
}

0 commit comments

Comments
 (0)