Add missing error check in BMessageFormat

* Avoids a crash when an invalid format pattern is used
* Add tests exercising this with various badly formatted patterns.