Explain crash when exception is thrown from Scope Guard
authorPhil Willoughby <philwill@fb.com>
Fri, 18 Nov 2016 16:08:19 +0000 (08:08 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Fri, 18 Nov 2016 16:23:48 +0000 (08:23 -0800)
commitae7e1fd07dc2c01baf23c294598fcc839c1e7c23
treee23ca98e814f0b6edd6e39934abf0756d7154dfc
parentaebb140d3e6d1837294bef12a3d922e40a1a8f08
Explain crash when exception is thrown from Scope Guard

Summary:
Print a message to `std::cerr` when the current program is about to call `std::terminate` because a `folly::ScopeGuard` callback threw an exception. This goes to `std::terminate` in the (common) cases when the `ScopeGuard` destructor is `noexcept`

This gives the user a small clue as to what just happened, since the default diagnostics for this on some platforms do not help at all.

Reviewed By: nbronson

Differential Revision: D4061096

fbshipit-source-id: c3b534d4a36b095e08e46f375251b6fd416ccd68
folly/Makefile.am
folly/ScopeGuard.cpp [new file with mode: 0644]
folly/ScopeGuard.h