Skip to content

Commit f3e079e

Browse files
committed
Merge branch 'master' into entity_rename
2 parents 3ebda70 + 44d58cd commit f3e079e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

appengine/flexible/hello_world/main.py

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# limitations under the License.
1414

1515
# [START app]
16+
import logging
17+
1618
from flask import Flask
1719

1820

@@ -25,6 +27,14 @@ def hello():
2527
return 'Hello World!'
2628

2729

30+
@app.errorhandler(500)
31+
def server_error(e):
32+
logging.exception('An error occurred during a request.')
33+
return """
34+
An internal error occurred: <pre>{}</pre>
35+
See logs for full stacktrace.
36+
""".format(e), 500
37+
2838
if __name__ == '__main__':
2939
# This is used when running locally. Gunicorn is used to run the
3040
# application on Google App Engine. See entrypoint in app.yaml.

appengine/flexible/hello_world_compat/main.py

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# limitations under the License.
1414

1515
# [START app]
16+
import logging
17+
1618
from flask import Flask
1719

1820

@@ -23,4 +25,13 @@
2325
def hello():
2426
"""Return a friendly HTTP greeting."""
2527
return 'Hello World!'
28+
29+
30+
@app.errorhandler(500)
31+
def server_error(e):
32+
logging.exception('An error occurred during a request.')
33+
return """
34+
An internal error occurred: <pre>{}</pre>
35+
See logs for full stacktrace.
36+
""".format(e), 500
2637
# [END app]

0 commit comments

Comments
 (0)