module V8
def self.Error(trycatch)
-
(V8::Error)
- the error generated by this try/catch
Parameters:
-
native
(V8::C::TryCatch
) -- trycatch object that has been triggered
def self.Error(trycatch) exception = trycatch.Exception() value = exception.to_ruby cause = nil message = trycatch.Message() javascript_backtrace = V8::StackTrace.new(message.GetStackTrace()) if message message = if !exception.kind_of?(V8::C::Value) exception.to_s==""?"Script Timed Out":exception.to_s elsif exception.IsNativeError() if cause = exception.GetHiddenValue("rr::Cause") cause = cause.Value() end if value['constructor'] == V8::Context.current['SyntaxError'] info = trycatch.Message() resource_name = info.GetScriptResourceName().to_ruby "#{value['message']} at #{resource_name}:#{info.GetLineNumber()}:#{info.GetStartColumn() + 1}" else exception.Get("message").to_ruby end elsif exception.IsObject() value['message'] || value.to_s else value.to_s end V8::Error.new(message, value, javascript_backtrace, cause) end