Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee8cf1c

Browse files
committed
Pass worker errors through to RPC for report error modal
1 parentab93533 commitee8cf1c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

‎backend/main/views.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def api_view(request, method_name):
5353
exceptException:
5454
result=dict(
5555
error=dict(
56-
traceback="".join(traceback.format_exc()),
56+
traceback=traceback.format_exc(),
5757
)
5858
)
5959
returnJsonResponse(result)
@@ -95,6 +95,9 @@ def run_code(self, code, source):
9595
entry.output=result["output"]
9696
entry.save()
9797

98+
ifresult["error"]:
99+
returndict(error=result["error"])
100+
98101
ifresult["passed"]:
99102
self.move_step(1)
100103

‎backend/main/workers/utils.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def make_result(
4242
output=None,
4343
output_parts=None,
4444
birdseye_objects=None,
45+
error=None,
4546
):
4647
ifoutputisNone:
4748
output=output_buffer.string()
@@ -56,21 +57,22 @@ def make_result(
5657
output=output,
5758
output_parts=output_parts,
5859
birdseye_objects=birdseye_objects,
60+
error=error,
5961
)
6062

6163

6264
definternal_error_result():
65+
tb=traceback.format_exc()
6366
output=f"""
6467
INTERNAL ERROR IN COURSE:
6568
=========================
6669
67-
{"".join(traceback.format_exc())}
70+
{tb}
6871
6972
This is an error in our code, not yours.
70-
Consider using the Feedback button in the top-right menu
71-
to explain what led up to this.
7273
"""
7374
returnmake_result(
7475
output=output,
7576
output_parts=[dict(color="red",text=output)],
77+
error=dict(traceback=tb),
7678
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp