Add onWillThrowError

This will allow packages to override the dev tools popping up behavior.
Mentioned it chat, documenting here for transparency/posterity: I think we should change it because our metrics package is the only caller.