Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programs with malfomed built-ins will not throw GUi-sided syntax errors #95

Open
slawrence100 opened this issue Nov 10, 2020 · 0 comments

Comments

@slawrence100
Copy link
Collaborator

See this example program:

while True:
  bot.moooooooove_forward(100)

Expected Behavior: The Python error message box should show a syntax error for bot.moooooooove_forward(100).

Actual Behavior: The Base Station throws an error that is not caught and shown on the GUI.

127.0.0.1 - - [10/Nov/2020 16:47:56] "POST /code/ HTTP/1.1" 500 -
2020-11-10 16:47:56,285 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2020-11-10 16:47:56,285 INFO sqlalchemy.engine.base.Engine SELECT program.id AS program_id, program.code AS program_code, program.time AS program_time, program.email AS program_email, program.duration AS program_duration 
FROM program
2020-11-10 16:47:56,286 INFO sqlalchemy.engine.base.Engine ()
2020-11-10 16:47:56,286 INFO sqlalchemy.engine.base.Engine ROLLBACK
127.0.0.1 - - [10/Nov/2020 16:47:56] "GET /program/ HTTP/1.1" 200 -
Code len = 36
<class 'bot.pi_bot.PiBot'>
RUNNING SCRIPT
ERROR:tornado.application:Uncaught exception POST /start (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8080', method='POST', uri='/start', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "base_station_interface.py", line 172, in post
    self.send_program(bot, value)
  File "base_station_interface.py", line 235, in send_program
    func = function_map[match.group(2)]
KeyError: 'moave_forward'
ERROR:tornado.access:500 POST /start (127.0.0.1) 114.22ms

I suspect that this is because the base station, not the bot itself, encounters this error; to my knowledge, we don't have a way to communicate this back to the client yet.

A possible fix would be to check the server's response code and use that to show a message on the GUI.

ruiqizhu26 added a commit that referenced this issue Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant