diff options
author | Corey Hulen <corey@hulen.com> | 2015-10-07 09:33:59 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-10-07 09:33:59 -0700 |
commit | c189e2bb7681ba01edc9b8c5accd90b94c898d0a (patch) | |
tree | cd77d46753b2308fff79678be3adb727aa238b23 /web/react/utils/client.jsx | |
parent | 3c859aebde2e9e11e8b1eeb4d8bb300400b4ad54 (diff) | |
parent | 8a65601db424d5969448b06ae4e3048a7f34bd94 (diff) | |
download | chat-c189e2bb7681ba01edc9b8c5accd90b94c898d0a.tar.gz chat-c189e2bb7681ba01edc9b8c5accd90b94c898d0a.tar.bz2 chat-c189e2bb7681ba01edc9b8c5accd90b94c898d0a.zip |
Merge pull request #951 from mattermost/PLT-500
PLT-500 fixing connection msg issues
Diffstat (limited to 'web/react/utils/client.jsx')
-rw-r--r-- | web/react/utils/client.jsx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index d9f486009..6dccfcdeb 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -2,6 +2,7 @@ var BrowserStore = require('../stores/browser_store.jsx'); var TeamStore = require('../stores/team_store.jsx'); +var ErrorStore = require('../stores/error_store.jsx'); export function track(category, action, label, prop, val) { global.window.analytics.track(action, {category: category, label: label, property: prop, value: val}); @@ -27,7 +28,16 @@ function handleError(methodName, xhr, status, err) { msg = 'error in ' + methodName + ' status=' + status + ' statusCode=' + xhr.status + ' err=' + err; if (xhr.status === 0) { - e = {message: 'There appears to be a problem with your internet connection', connErrorCount: 1}; + let errorCount = 1; + const oldError = ErrorStore.getLastError(); + let connectError = 'There appears to be a problem with your internet connection'; + + if (oldError && oldError.connErrorCount) { + errorCount += oldError.connErrorCount; + connectError = 'We cannot reach the Mattermost service. The service may be down or misconfigured. Please contact an administrator to make sure the WebSocket port is configured properly.'; + } + + e = {message: connectError, connErrorCount: errorCount}; } else { e = {message: 'We received an unexpected status code from the server (' + xhr.status + ')'}; } |