Skip to content

Commit

Permalink
feat(server): report full traceback from skills execution
Browse files Browse the repository at this point in the history
  • Loading branch information
louistiti committed Jun 11, 2022
1 parent 567b030 commit b69b1fe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
8 changes: 7 additions & 1 deletion bridges/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding:utf-8 -*-

import utils
from traceback import print_exc
from sys import path
from json import dumps, loads
from importlib import import_module
Expand All @@ -27,4 +28,9 @@ def main():
return getattr(skill, intent_obj['action'])(params)

if __name__ == '__main__':
main()
try:
raise main()
except Exception as e:
# Print full traceback error report if skills triggers an error from the call stack
if 'exceptions must derive from BaseException' not in str(e):
print_exc()
12 changes: 10 additions & 2 deletions server/src/core/nlu.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ class Nlu {

// When the active context has slots filled
if (Object.keys(this.conv.activeContext.slots).length > 0) {
return resolve(await this.handleSlotFilling(utterance, opts))
try {
return resolve(await this.handleSlotFilling(utterance, opts))
} catch (e) {
return reject({ })
}
}
}

Expand Down Expand Up @@ -438,7 +442,11 @@ class Nlu {

// In case all slots have been filled in the first utterance
if (this.conv.hasActiveContext() && Object.keys(this.conv.activeContext.slots).length > 0) {
return resolve(await this.handleSlotFilling(utterance, opts))
try {
return resolve(await this.handleSlotFilling(utterance, opts))
} catch (e) {
return reject({ })
}
}

const newContextName = `${this.nluResultObj.classification.domain}.${skillName}`
Expand Down
2 changes: 1 addition & 1 deletion skills/leon/introduction/nlu/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"name": "date"
},
"questions": [
"What's your birth date {{ person }}?"
"What's your birth date?"
]
}
],
Expand Down
6 changes: 3 additions & 3 deletions skills/leon/introduction/src/actions/remember.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from random import randint

def remember(params):
"""Save name and birth date in Leon's memory"""
"""Save name and birth date into Leon's memory"""

slots = params['slots']
owner_name = slots['owner_name']['value']['resolution']['value']
owner_birth_date = slots['owner_birthdate']['value']['resolution']['value']
owner_birth_date = slots['owner_birth_date']['value']['resolution']['timex']

return utils.output('end', 'default', utils.translate('default', { 'owner_name': owner_name }))
return utils.output('end', 'remembered', utils.translate('remembered', { 'owner_name': owner_name }))

0 comments on commit b69b1fe

Please sign in to comment.