-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more detailed error messages for known Browser/OS issues
- Loading branch information
Showing
5 changed files
with
105 additions
and
10 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,9 @@ | ||
export const IESecurityError18 = ( | ||
<span> | ||
Unable to connect to local intranet. This is a known error when using | ||
Internet Explorer. For more help resolving this issue{' '} | ||
<a href='https://stackoverflow.com/a/41643700' target='_blank'> | ||
click here | ||
</a> | ||
</span> | ||
) |
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,33 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo4j, Inc" | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { IESecurityError18 } from './Errors/IESecurityErrors' | ||
|
||
const error = (title, message) => ({ | ||
title, | ||
message: message || title | ||
}) | ||
|
||
const knownErrors = { | ||
18: IESecurityError18 | ||
} | ||
|
||
export const errorMessageFormater = (code, message) => | ||
error(`${code}${message ? ':' : ''} ${message || ''}`, knownErrors[code]) |
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,50 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo4j, Inc" | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* global describe, test, expect */ | ||
|
||
import render from 'preact-render-to-string' | ||
import { errorMessageFormater } from './errorMessageFormater' | ||
|
||
describe('errorsHelper', () => { | ||
test('should display custom message when code is 13 (IE + ws://localhost issue)', () => { | ||
const error = errorMessageFormater(13) | ||
|
||
expect(error.title).toContain('13') | ||
expect(error.message).toBeTruthy() | ||
expect(render(error.message)).toContain('Internet Explorer') | ||
}) | ||
test('should return error code as code and message when message is missing', () => { | ||
const errorCode = 0 | ||
const error = errorMessageFormater(errorCode) | ||
|
||
expect(error.title.trim()).toEqual(errorCode.toString()) | ||
expect(error.message.trim()).toEqual(errorCode.toString()) | ||
}) | ||
test('should return error code and message', () => { | ||
const errorCode = 0 | ||
const errorText = 'foobar' | ||
const error = errorMessageFormater(errorCode, errorText) | ||
|
||
expect(error.title.trim()).toContain(errorCode.toString()) | ||
expect(error.title.trim()).toContain(errorText) | ||
expect(error.message.trim()).toContain(errorText) | ||
}) | ||
}) |