revert format()'s behavior of crashing on error
authorAdam Simpkins <simpkins@fb.com>
Mon, 27 Jan 2014 01:47:48 +0000 (17:47 -0800)
committerSara Golemon <sgolemon@fb.com>
Thu, 6 Feb 2014 19:50:13 +0000 (11:50 -0800)
commite1a2cdefda74db3039afc03e9579e7cf56b910cd
tree00d373fd823dd0fd5c46900a05500596fb9feeaa
parente0b08360d75ad0a188116358786fcb527786498f
revert format()'s behavior of crashing on error

Summary:
This reverts 61e20daa, which changed the format code to abort on error.

I do plan to restore the crashing behavior, but I plan to make it
optional.  I will add a formatSafe() function that throws on error,
while format() catches these exceptions and crashes.

This diff is an intermediate diff to make it easier to review the
changes.  This is close to a straight revert of 61e20daa and 61a41c9b.
However, I did leave the new test case, as well as the
FormatArg::errorStr() method added by those diffs.

Test Plan:
Verified that the existing format tests pass.

Also added a handful of new tests for bad format strings.  This did
catch one bug in the code where it wasn't correctly checking for a null
return value from memchr().

Reviewed By: delong.j@fb.com

FB internal diff: D1144298
folly/Format-inl.h
folly/Format.cpp
folly/Format.h
folly/FormatArg.h
folly/test/FormatTest.cpp