-
Notifications
You must be signed in to change notification settings - Fork 1
fix: enhance error handling and messaging for URL submissions and pro… #1256
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
43651f9
fix: enhance error handling and messaging for URL submissions and pro…
gibahjoe 2d70942
fix: enhance error handling for 403 responses and include organisatio…
gibahjoe 881645e
fix: handle locally detected 403 errors with detailed organisation in…
gibahjoe 9aadf53
updated page content
gibahjoe 2287452
Merge branch 'main' into 2920-stockton-on-tees-endpoint-issues
gibahjoe 5cef431
fix: update error message for restricted 403 responses to clarify URL…
gibahjoe 842ec57
Merge branch '2920-stockton-on-tees-endpoint-issues' of https://githu…
gibahjoe 73c5556
Merge branch 'main' into 2920-stockton-on-tees-endpoint-issues
gibahjoe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,49 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { setupNunjucks } from '../../../../src/serverSetup/nunjucks.js' | ||
|
|
||
| const nunjucks = setupNunjucks({ datasetNameMapping: new Map() }) | ||
|
|
||
| const renderError = (errorDetail, organisation = {}) => nunjucks.render('check/error-redirect.html', { | ||
| err: { | ||
| message: 'A user-facing message that may change', | ||
| errorDetail, | ||
| ...organisation | ||
| } | ||
| }) | ||
|
|
||
| describe('check error redirect page', () => { | ||
| it('uses the exception type for SSL certificate errors', () => { | ||
| const html = renderError({ exceptionType: 'SSLCertVerificationError' }) | ||
|
|
||
| expect(html).toContain('We could not verify the Secure Sockets Layer (SSL) certificate') | ||
| }) | ||
|
|
||
| it('renders the dedicated 403 page and LPA overview link', () => { | ||
| const html = renderError({ errCode: '403', contentType: 'text/html' }, { | ||
| organisationId: 'local-authority:ABC', | ||
| organisationName: 'Example Council' | ||
| }) | ||
|
|
||
| expect(html).toContain('We cannot access your endpoint URL') | ||
| expect(html).toContain('host the URL on a server that does not block access with set permissions') | ||
| expect(html).toContain('remove any bot protection that blocks automated downloads') | ||
| expect(html).toContain('‘HTTP status code 403’ error') | ||
| expect(html).toContain('digitalland@communities.gov.uk') | ||
| expect(html).toContain('href="/organisations/local-authority%3AABC"') | ||
| expect(html).toContain('Return to Example Council overview') | ||
| expect(html).not.toContain('There’s a problem') | ||
| }) | ||
|
|
||
| it('uses the content type for HTML responses', () => { | ||
| const html = renderError({ contentType: 'text/html; charset=UTF-8' }) | ||
|
|
||
| expect(html).toContain('The URL returns a HTML webpage') | ||
| }) | ||
|
|
||
| it('uses the error code and plugin for ArcGIS layer errors', () => { | ||
| const html = renderError({ errCode: '200', plugin: 'arcgis' }) | ||
|
|
||
| expect(html).toContain('The URL you have provided is an ArcGIS link, which is not the data layer') | ||
| expect(html).not.toContain('contact support') | ||
| }) | ||
| }) |
This file contains hidden or 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,17 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { setupNunjucks } from '../../../../src/serverSetup/nunjucks.js' | ||
|
|
||
| const nunjucks = setupNunjucks({ datasetNameMapping: new Map() }) | ||
|
|
||
| describe('check URL page', () => { | ||
| it('explains that bot protection can cause a 403 error', () => { | ||
| const html = nunjucks.render('check/url.html', { | ||
| errors: { url: { type: 'restricted403' } }, | ||
| options: {}, | ||
| data: { check: { url: '' } } | ||
| }) | ||
|
|
||
| expect(html).toContain('bot protection, such as Cloudflare or Imperva') | ||
| expect(html).toContain('The URL must be accessible') | ||
| }) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.