Skip to content

Commit

Permalink
Polish dy2st error message (#52527)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x45f authored Apr 7, 2023
1 parent d2939ca commit 8da89b8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions python/paddle/jit/dy2static/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,18 @@ def create_message(self):

# Simplify error value to improve readability if error is raised in runtime
if self.in_runtime:
if int(
os.getenv(SIMPLIFY_ERROR_ENV_NAME, DEFAULT_SIMPLIFY_NEW_ERROR)
):
self._simplify_error_value()
message_lines.append(str(self.error_value))
return '\n'.join(message_lines)
try:
if int(
os.getenv(
SIMPLIFY_ERROR_ENV_NAME, DEFAULT_SIMPLIFY_NEW_ERROR
)
):
self._simplify_error_value()
except:
pass
else:
message_lines.append(str(self.error_value))
return '\n'.join(message_lines)

# Step2: Optimizes stack information with source code information of dygraph from user.
user_code_traceback_index = []
Expand Down

0 comments on commit 8da89b8

Please sign in to comment.