Replace CHECK in Range.h by throw std::out_of_range
authorMaxime Boucher <maxime@fb.com>
Fri, 10 May 2013 18:42:20 +0000 (11:42 -0700)
committerSara Golemon <sgolemon@fb.com>
Mon, 20 May 2013 18:01:27 +0000 (11:01 -0700)
commitd327d57f3f825fb2ccee97d7223e311c5cf23087
treedec33d8de25028b5d22bd26c3098f4209d5c8635
parent9cdd19b750f66db9171344c9db2d21c27de467d9
Replace CHECK in Range.h by throw std::out_of_range

Summary:
Calling CHECK() in folly will force the program to abort in case of a failure.
On the other hand, for range checking, the standard library throws std::out_of_range for many functions.

Thus it could be a good idea to throw the same exception in folly so that errors can be handled using try {} catch (...) {} blocks.

Test Plan:
from fbcode, type:
fbconfig -r folly; fbmake opt -j32; fbmake runtests_opt -j 32

What other tests should I run?

Reviewed By: tudorb@fb.com

FB internal diff: D808204
folly/Range.cpp
folly/Range.h
folly/test/RangeTest.cpp