-
Notifications
You must be signed in to change notification settings - Fork 49
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
fix: check for failed state during session log stream to prevent unbounded loop #564
Conversation
@@ -204,6 +204,7 @@ export class ComputeSession extends Compute { | |||
"warning", | |||
"completed", | |||
"idle", | |||
"failed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
failed is one of the possible job states that indicates that the request is finished. Add it here so that the while loop will properly terminate on failed jobs.
I noticed that after fixing this, we get a rather ugly looking stringified json object rendered in the error message toast. This is due to how we're currently showing error messages for the run command.As part of this PR I'd propose that we come up with a way to clean this up a little. There are a few different error models that we could encounter at this level:
Based on these possible states it seems like we might need some sort of well known translator that knows how to deal with the possibly different types coming in. Thoughts? I've looked into making the error display in a modal error message, but it looks fairly different than the usual toast messages. The other tricky part specifically in the expired license case is that the context of the error that tells the user what's going on is actually in the details array, whereas the message value on that case is not very clear. VSCode's error dialog in the modal option does allow for passing details in a details array. One such approach might be to detect if we are dealing with an error representation, if we are, then see if there are details. On the case of a details array we'd use the modal form. In the case of empty or undefined details array we'd use the normal brief toast message approach. Thoughts? |
Example of what the modal dialog for expired license would look like. Message is the top string and the details array are joined in the detail text below: Accompanying (rough) code concept out at: main...vscode-modal-error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Modal dialog looks good to me. I guess the most tricky part is where's the real detail. I remembered some errors where details is also complex objects. |
@scnwwu could I trouble you for another review? I pushed some code that switches over to the modal dialog approach discussed further up. |
"Connecting to SAS Session" will not hang when attempting to connect to an expired deployment. And now it will show error 'Request failed with status code 400'. |
Summary
Check for failed state when streaming the session log to avoid attempting to check for logs in an unbounded loop.
Testing
Steps in #562