aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go
diff options
context:
space:
mode:
Diffstat (limited to 'Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go')
-rw-r--r--Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go
new file mode 100644
index 000000000..c469f5fcb
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go
@@ -0,0 +1,13 @@
+package otto
+
+func (rt *_runtime) newErrorObject(name string, message Value) *_object {
+ self := rt.newClassObject("Error")
+ if message.IsDefined() {
+ msg := message.string()
+ self.defineProperty("message", toValue_string(msg), 0111, false)
+ self.value = newError(rt, name, msg)
+ } else {
+ self.value = newError(rt, name)
+ }
+ return self
+}