Show More
@@ -141,31 +141,32 b' def get_request_metadata(request=None) -' | |||
|
141 | 141 | return request_metadata |
|
142 | 142 | |
|
143 | 143 | |
|
144 | def format_exc(exc_info): | |
|
144 | def format_exc(exc_info, use_detailed_tb=True): | |
|
145 | 145 | exc_type, exc_value, exc_traceback = exc_info |
|
146 | 146 | tb = "++ TRACEBACK ++\n\n" |
|
147 | 147 | tb += "".join(traceback.format_exception(exc_type, exc_value, exc_traceback, None)) |
|
148 | ||
|
148 | ||
|
149 | 149 | detailed_tb = getattr(exc_value, "_org_exc_tb", None) |
|
150 | ||
|
150 | ||
|
151 | 151 | if detailed_tb: |
|
152 | 152 | remote_tb = detailed_tb |
|
153 | 153 | if isinstance(detailed_tb, str): |
|
154 | 154 | remote_tb = [detailed_tb] |
|
155 | ||
|
155 | ||
|
156 | 156 | tb += ( |
|
157 | 157 | "\n+++ BEG SOURCE EXCEPTION +++\n\n" |
|
158 | 158 | "{}\n" |
|
159 | 159 | "+++ END SOURCE EXCEPTION +++\n" |
|
160 | 160 | "".format("\n".join(remote_tb)) |
|
161 | 161 | ) |
|
162 | ||
|
162 | ||
|
163 | 163 | # Avoid that remote_tb also appears in the frame |
|
164 | 164 | del remote_tb |
|
165 | ||
|
166 | locals_tb = get_detailed_tb(exc_info) | |
|
167 | if locals_tb: | |
|
168 | tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" "" | |
|
165 | ||
|
166 | if use_detailed_tb: | |
|
167 | locals_tb = get_detailed_tb(exc_info) | |
|
168 | if locals_tb: | |
|
169 | tb += f"\n+++ DETAILS +++\n\n{locals_tb}\n" "" | |
|
169 | 170 | return tb |
|
170 | 171 | |
|
171 | 172 |
General Comments 0
You need to be logged in to leave comments.
Login now