aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/robertkrimen/otto/type_error.go
blob: c469f5fcb26b844d241c66f1dfd610bf586c307f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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
}