File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
# [START app]
16
+ import logging
17
+
16
18
from flask import Flask
17
19
18
20
@@ -25,6 +27,14 @@ def hello():
25
27
return 'Hello World!'
26
28
27
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
37
+
28
38
if __name__ == '__main__' :
29
39
# This is used when running locally. Gunicorn is used to run the
30
40
# application on Google App Engine. See entrypoint in app.yaml.
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
# [START app]
16
+ import logging
17
+
16
18
from flask import Flask
17
19
18
20
23
25
def hello ():
24
26
"""Return a friendly HTTP greeting."""
25
27
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
26
37
# [END app]
You can’t perform that action at this time.
0 commit comments