From fc5026da1ee0021abfefcefaee2ec41c0583b2c2 Mon Sep 17 00:00:00 2001 From: hanhxiao Date: Fri, 2 Aug 2019 13:40:57 +0800 Subject: [PATCH] fix(board): improve gnes board 500 message --- gnes/composer/flask.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gnes/composer/flask.py b/gnes/composer/flask.py index fe132c11..c94a671b 100644 --- a/gnes/composer/flask.py +++ b/gnes/composer/flask.py @@ -39,6 +39,13 @@ def _create_flask_app(self): args = set_composer_parser().parse_args([]) default_html = YamlComposer(args).build_all()['html'] + @app.errorhandler(500) + def exception_handler(error): + self.logger.error('unhandled error, i better quit and restart!') + return '

500 Internal Error

' \ + 'While we are fixing the issue, do you know you can deploy GNES board locally on your machine? ' \ + 'Simply run
docker run -d -p 0.0.0.0:80:8080/tcp gnes/gnes compose --flask
', 500 + @app.route('/', methods=['GET']) def _get_homepage(): return default_html