@@ -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