MCPcopy Create free account
hub / github.com/aurora-develop/Duck2api / jsErrorString

Function jsErrorString

internal/duckgo/vqd.go:121–139  ·  view source on GitHub ↗
(vm *goja.Runtime, err error, value goja.Value)

Source from the content-addressed store, hash-verified

119}
120
121func jsErrorString(vm *goja.Runtime, err error, value goja.Value) string {
122 if err != nil {
123 if exception, ok := err.(*goja.Exception); ok {
124 return exception.String()
125 }
126 return err.Error()
127 }
128 if value == nil || goja.IsUndefined(value) || goja.IsNull(value) {
129 return "<empty>"
130 }
131 object := value.ToObject(vm)
132 if stack := object.Get("stack"); !goja.IsUndefined(stack) && !goja.IsNull(stack) {
133 return stack.String()
134 }
135 if message := object.Get("message"); !goja.IsUndefined(message) && !goja.IsNull(message) {
136 return message.String()
137 }
138 return value.String()
139}
140
141const vqdResultMutationScript = `
142(function (result) {

Callers 1

executeVQDHashScriptFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected