Skip to content

CHE-10540: stop progress on websocket error#10688

Merged
akurinnoy merged 3 commits intoeclipse-che:masterfrom
akurinnoy:CHE-10540
Aug 8, 2018
Merged

CHE-10540: stop progress on websocket error#10688
akurinnoy merged 3 commits intoeclipse-che:masterfrom
akurinnoy:CHE-10540

Conversation

@akurinnoy
Copy link
Copy Markdown
Contributor

What does this PR do?

When workspace loader starts a workspace and receives an error on websocket, then error appears and the progress bar hides.
restart2

What issues does this PR fix or reference?

fix #10540

Release Notes

N/A - bugfix

Docs PR

N/A - bugfix

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
@akurinnoy akurinnoy added kind/bug Outline of a bug - must adhere to the bug report template. status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. labels Aug 7, 2018
@akurinnoy akurinnoy self-assigned this Aug 7, 2018
@akurinnoy akurinnoy requested a review from vparfonov as a code owner August 7, 2018 11:47
try {
const response = JSON.parse(xhr.responseText);
errorMessage = response.message;
} catch (e) { }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we log error message/response ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is eventually logged here https://github.com/eclipse/che/blob/389e259d7672fe57300f10ad19657076ea7f19f9/workspace-loader/src/index.ts#L145-L146

Here I only tried to get a meaningful error message to reject a workspace getting or starting promise.

(message: any) => {
if (message.error) {
this.loader.error(message.error);
reject(`Failed to run the workspace: "${message.error}"`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we reject with new Error() ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it may be useful, I'll fix this.

this.loader.error(message.error);
reject(`Failed to run the workspace: "${message.error}"`);
} else if (message.status === 'RUNNING') {
resolve();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we, please, also check "runtime" is there (not null), when we have RUNNING status. If not - reject the promise.
There is usecase, when user tries to open shared workspace, where he has no permissions on runtime.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure, I'll add a fixup

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

More details here #10687
Maybe we can also handle second use case here when POST /workspace/WS_ID/runtime is failed

Copy link
Copy Markdown
Contributor Author

@akurinnoy akurinnoy Aug 7, 2018

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cool. I missed it because PR title and even description tell nothing about this change.

Looks like we will be able to close that issue after merge. I can recheck after merge.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was another PR #10642 which is already merged.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see, thanks.
I did find the given lines in master and you pointed commit from this PR, it's why I thought that it is introduced in this PR =)

@akurinnoy akurinnoy merged commit 8bf02a9 into eclipse-che:master Aug 8, 2018
@akurinnoy akurinnoy deleted the CHE-10540 branch August 8, 2018 10:13
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Aug 9, 2018
@benoitf benoitf added this to the 6.10.0 milestone Aug 9, 2018
skabashnyuk pushed a commit to skabashnyuk/che that referenced this pull request Mar 11, 2020
…e-che#10688)

* code clean-up

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>

* CHE-10540: stop workspace loading progress on websocket error

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>

* fixup! CHE-10540: stop workspace loading progress on websocket error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Outline of a bug - must adhere to the bug report template.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make workspace-loader (or UD) show an error received from websocket on workspace start failure

6 participants