Skip to content

Commit

Permalink
Merge pull request #1048 from CPatchane/add_terms_error
Browse files Browse the repository at this point in the history
Handle terms mismatch service error
  • Loading branch information
gregorylegarec committed Jan 10, 2019
2 parents d3295e3 + 9e1f5e8 commit edff757
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/konnectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const ERROR_TYPES = {
LOGIN_FAILED: 'LOGIN_FAILED',
MAINTENANCE: 'MAINTENANCE',
NOT_EXISTING_DIRECTORY: 'NOT_EXISTING_DIRECTORY',
TERMS_VERSION_MISMATCH: 'TERMS_VERSION_MISMATCH',
USER_ACTION_NEEDED: 'USER_ACTION_NEEDED',
VENDOR_DOWN: 'VENDOR_DOWN',
DISK_QUOTA_EXCEEDED: 'DISK_QUOTA_EXCEEDED'
Expand Down Expand Up @@ -60,6 +61,7 @@ export function isKonnectorUserError(error) {
ERROR_TYPES.DISK_QUOTA_EXCEEDED,
ERROR_TYPES.LOGIN_FAILED,
ERROR_TYPES.NOT_EXISTING_DIRECTORY,
ERROR_TYPES.TERMS_VERSION_MISMATCH,
ERROR_TYPES.USER_ACTION_NEEDED
].includes(error.type)
)
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@
"title": "Action needed on the provider",
"description": "It seems that the [%{name}](%{link}) website requires you to log in and to do a specific action. Please rerun the connector once you have settled the issue on the website."
},
"TERMS_VERSION_MISMATCH": {
"title": "Service terms not matched",
"description": "Our partner Budget Insight got its terms changed. You must sign them in order to keep using this service. If you encounter any problem, you can contact us at contact@cozycloud.cc."
},
"USER_ACTION_NEEDED.OAUTH_OUTDATED": {
"title": "Access refresh required",
"description": "It seems that the [%{name}](%{link}) website requires you to refresh the access you gave to the connector. Please disconnect and reconnect this connector. No data will be lost."
Expand Down
32 changes: 32 additions & 0 deletions test/lib/konnectors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,38 @@ describe('konnectors lib', () => {
).toBe(true)
})

it('returns true for CHALLENGE_ASKED', () => {
expect(
konnectors.isKonnectorUserError(
konnectors.buildKonnectorError('CHALLENGE_ASKED')
)
).toBe(true)
})

it('returns true for DISK_QUOTA_EXCEEDED', () => {
expect(
konnectors.isKonnectorUserError(
konnectors.buildKonnectorError('DISK_QUOTA_EXCEEDED')
)
).toBe(true)
})

it('returns true for NOT_EXISTING_DIRECTORY', () => {
expect(
konnectors.isKonnectorUserError(
konnectors.buildKonnectorError('NOT_EXISTING_DIRECTORY')
)
).toBe(true)
})

it('returns true for TERMS_VERSION_MISMATCH', () => {
expect(
konnectors.isKonnectorUserError(
konnectors.buildKonnectorError('TERMS_VERSION_MISMATCH')
)
).toBe(true)
})

it('returns false for any other error', () => {
expect(
konnectors.isKonnectorUserError(
Expand Down

0 comments on commit edff757

Please sign in to comment.