Skip to content

Conversation

@N-give
Copy link
Contributor

@N-give N-give commented Apr 1, 2025

closes #78

"""
stacktrace = traceback.format_exc()
index = stacktrace.index("iwf-python-sdk/iwf/worker_service.py")
index = stacktrace.find("iwf-python-sdk/iwf/worker_service.py")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be this, to avoid the if statement?

Suggested change
index = stacktrace.find("iwf-python-sdk/iwf/worker_service.py")
index = max(0, stacktrace.find("iwf-python-sdk/iwf/worker_service.py"))

@N-give N-give merged commit 534e582 into main Apr 1, 2025
2 checks passed
index = stacktrace.index("iwf-python-sdk/iwf/worker_service.py")
index = max(0, stacktrace.find("iwf-python-sdk/iwf/worker_service.py"))
return "WorkerExecutionError: {0}; StackTrace:{1}".format(
exception, stacktrace[index:]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean full stacktrace will be returned if no iwf-python-sdk/iwf/worker_service.py found?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. find will return -1 if the file isn't found, so use 0, and the string slice will include the full stacktrace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

index may be not found for finding error trace

4 participants