aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/olebedev/go-duktape.v3/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/olebedev/go-duktape.v3/utils.go')
-rw-r--r--vendor/gopkg.in/olebedev/go-duktape.v3/utils.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/gopkg.in/olebedev/go-duktape.v3/utils.go b/vendor/gopkg.in/olebedev/go-duktape.v3/utils.go
new file mode 100644
index 000000000..86191239b
--- /dev/null
+++ b/vendor/gopkg.in/olebedev/go-duktape.v3/utils.go
@@ -0,0 +1,10 @@
+package duktape
+
+// Must returns existing *Context or throw panic.
+// It is highly recommended to use Must all the time.
+func (d *Context) Must() *Context {
+ if d.duk_context == nil {
+ panic("[duktape] Context does not exists!\nYou cannot call any contexts methods after `DestroyHeap()` was called.")
+ }
+ return d
+}