-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6399 from ian-r-rose/connection-lost-token
Connection lost token
- Loading branch information
Showing
15 changed files
with
359 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { showErrorMessage } from '@jupyterlab/apputils'; | ||
|
||
import { ServerConnection, ServiceManager } from '@jupyterlab/services'; | ||
|
||
import { IConnectionLost } from './tokens'; | ||
|
||
/** | ||
* A default connection lost handler, which brings up an error dialog. | ||
*/ | ||
export const ConnectionLost: IConnectionLost = async function( | ||
manager: ServiceManager.IManager, | ||
err: ServerConnection.NetworkError | ||
): Promise<void> { | ||
if (Private.showingError) { | ||
return; | ||
} | ||
Private.showingError = true; | ||
|
||
const title = 'Server Connection Error'; | ||
const networkMsg = | ||
'A connection to the Jupyter server could not be established.\n' + | ||
'JupyterLab will continue trying to reconnect.\n' + | ||
'Check your network connection or Jupyter server configuration.\n'; | ||
|
||
return showErrorMessage(title, { message: networkMsg }).then(() => { | ||
Private.showingError = false; | ||
}); | ||
}; | ||
|
||
/** | ||
* A namespace for module private functionality. | ||
*/ | ||
namespace Private { | ||
/** | ||
* Whether the connection lost error is currently being shown. | ||
*/ | ||
export let showingError = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.