module V8::Error::Protect

def protect

def protect
  yield
rescue Exception => e
  error = V8::C::Exception::Error(e.message)
  error.SetHiddenValue("rr::Cause", V8::C::External::New(e))
  V8::C::ThrowException(error)
end