Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor Stuck in Infinite Loop #41

Open
nikhilcharles-ncc opened this issue Aug 1, 2024 · 0 comments
Open

Editor Stuck in Infinite Loop #41

nikhilcharles-ncc opened this issue Aug 1, 2024 · 0 comments

Comments

@nikhilcharles-ncc
Copy link

Hi! I was editing a flow using :bbpb.edit request-body, but I noticed that if an invalid edit is saved, the editor (vim in my case) is reopened without an explanation. Even after closing the editor multiple times, the editor is reopened unless the invalid change is reverted.

When I reverted the change, the log showed the following error message: Error: [14:20:43.902] Error while editing typedef: Encountered error encoding message: Field '2' not found in typedef or does not have type attribute..

I did some digging in the code and It looks like this is the spot where the infinite loop happens:

while True:
last_data = message_json
edited_output = ctx.master.spawn_editor(edited_output)
if edited_output == last_data:
# No changes to the message, just cancel
return
try:
protobuf_data = blackboxprotobuf.protobuf_from_json(
edited_output, typedef_out
)
break
except Exception as ex:
logging.error(f"Error while editing typedef: {ex}")

Perhaps a fix could be to break the loop when an exception occurs or to present the error to the user before respawning the editor.

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

No branches or pull requests

1 participant