MCPcopy Create free account
hub / github.com/devld/go-drive / ThrowError

Method ThrowError

script/runtime.go:130–141  ·  view source on GitHub ↗
(e any)

Source from the content-addressed store, hash-verified

128}
129
130func (v *VM) ThrowError(e any) {
131 if oe, ok := e.(otto.Value); ok {
132 panic(oe)
133 }
134 if re, ok := e.(err.Error); ok {
135 panic(v.o.MakeCustomError("Error", fmt.Sprintf("E:%s:%d:%s", re.Name(), re.Code(), re.Error())))
136 }
137 if ee, ok := e.(error); ok {
138 panic(v.o.MakeCustomError("Error", ee.Error()))
139 }
140 panic(v.o.MakeCustomError("Error", fmt.Sprintf("%v", e)))
141}
142
143func ThrowDetachedError(e any) {
144 message := errorMessage(e)

Callers 15

NewTempFileFunction · 0.80
ReadMethod · 0.80
ReadAsStringMethod · 0.80
CloseMethod · 0.80
WriteMethod · 0.80
CopyFromMethod · 0.80
SeekToMethod · 0.80
SizeMethod · 0.80
CloseMethod · 0.80
vm_base64DecodeFunction · 0.80
vm_urlBase64DecodeFunction · 0.80
vm_fromHexFunction · 0.80

Calls 3

NameMethod · 0.65
CodeMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected