From 47d16bffd01f35dc784d3ff0d621c382df5971c3 Mon Sep 17 00:00:00 2001 From: Adam Babik Date: Thu, 23 Nov 2017 13:47:20 +0100 Subject: [PATCH] fix Parse --- geth/jail/jail.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/geth/jail/jail.go b/geth/jail/jail.go index 012ca916a..574eeeb4a 100644 --- a/geth/jail/jail.go +++ b/geth/jail/jail.go @@ -167,17 +167,21 @@ func (j *Jail) CreateAndInitCell(chatID string, code ...string) string { func (j *Jail) Parse(chatID, code string) string { cell, err := j.cell(chatID) if err != nil { - // cell does not exist + // cell does not exist, so create and init it cell, err = j.createAndInitCell(chatID, code) } else { - // cell already exist, so just execute the code - _, err = cell.Run(code) + // cell already exists, so just reinit it + err = j.initCell(cell) } if err != nil { return newJailErrorResponse(err) } + if _, err = cell.Run(code); err != nil { + return newJailErrorResponse(err) + } + return j.makeCatalogVariable(cell) }