diff --git a/packages/backend/src/apps/deepl/auth/is-still-verified.ts b/packages/backend/src/apps/deepl/auth/is-still-verified.ts index 95a1ef29..66bb963e 100644 --- a/packages/backend/src/apps/deepl/auth/is-still-verified.ts +++ b/packages/backend/src/apps/deepl/auth/is-still-verified.ts @@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types'; import verifyCredentials from './verify-credentials'; const isStillVerified = async ($: IGlobalVariable) => { - try { - await verifyCredentials($); - return true; - } catch (error) { - return false; - } + await verifyCredentials($); + return true; }; export default isStillVerified; diff --git a/packages/backend/src/apps/discord/auth/is-still-verified.ts b/packages/backend/src/apps/discord/auth/is-still-verified.ts index b34d1517..fadd0880 100644 --- a/packages/backend/src/apps/discord/auth/is-still-verified.ts +++ b/packages/backend/src/apps/discord/auth/is-still-verified.ts @@ -2,13 +2,9 @@ import { IGlobalVariable } from '@automatisch/types'; import getCurrentUser from '../common/get-current-user'; const isStillVerified = async ($: IGlobalVariable) => { - try { - await getCurrentUser($); + await getCurrentUser($); - return true; - } catch (error) { - return false; - } + return true; }; export default isStillVerified; diff --git a/packages/backend/src/apps/flickr/auth/is-still-verified.ts b/packages/backend/src/apps/flickr/auth/is-still-verified.ts index 76547cc8..634776a9 100644 --- a/packages/backend/src/apps/flickr/auth/is-still-verified.ts +++ b/packages/backend/src/apps/flickr/auth/is-still-verified.ts @@ -1,17 +1,13 @@ import { IGlobalVariable } from '@automatisch/types'; const isStillVerified = async ($: IGlobalVariable) => { - try { - const params = { - method: 'flickr.test.login', - format: 'json', - nojsoncallback: 1, - }; - const response = await $.http.get('/rest', { params }); - return !!response.data.user.id; - } catch (error) { - return false; - } + const params = { + method: 'flickr.test.login', + format: 'json', + nojsoncallback: 1, + }; + const response = await $.http.get('/rest', { params }); + return !!response.data.user.id; }; export default isStillVerified; diff --git a/packages/backend/src/apps/github/auth/is-still-verified.ts b/packages/backend/src/apps/github/auth/is-still-verified.ts index 060ad5cd..befb7694 100644 --- a/packages/backend/src/apps/github/auth/is-still-verified.ts +++ b/packages/backend/src/apps/github/auth/is-still-verified.ts @@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types'; import getCurrentUser from '../common/get-current-user'; const isStillVerified = async ($: IGlobalVariable) => { - try { - const user = await getCurrentUser($); - return !!user.id; - } catch (error) { - return false; - } + const user = await getCurrentUser($); + return !!user.id; }; export default isStillVerified; diff --git a/packages/backend/src/apps/salesforce/auth/is-still-verified.ts b/packages/backend/src/apps/salesforce/auth/is-still-verified.ts index 8f578344..d36919f2 100644 --- a/packages/backend/src/apps/salesforce/auth/is-still-verified.ts +++ b/packages/backend/src/apps/salesforce/auth/is-still-verified.ts @@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types'; import getCurrentUser from '../common/get-current-user'; const isStillVerified = async ($: IGlobalVariable) => { - try { - const user = await getCurrentUser($); - return !!user; - } catch (error) { - return false; - } + const user = await getCurrentUser($); + return !!user; }; export default isStillVerified; diff --git a/packages/backend/src/apps/slack/auth/is-still-verified.ts b/packages/backend/src/apps/slack/auth/is-still-verified.ts index 060ad5cd..befb7694 100644 --- a/packages/backend/src/apps/slack/auth/is-still-verified.ts +++ b/packages/backend/src/apps/slack/auth/is-still-verified.ts @@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types'; import getCurrentUser from '../common/get-current-user'; const isStillVerified = async ($: IGlobalVariable) => { - try { - const user = await getCurrentUser($); - return !!user.id; - } catch (error) { - return false; - } + const user = await getCurrentUser($); + return !!user.id; }; export default isStillVerified; diff --git a/packages/backend/src/apps/smtp/auth/is-still-verified.ts b/packages/backend/src/apps/smtp/auth/is-still-verified.ts index 95a1ef29..66bb963e 100644 --- a/packages/backend/src/apps/smtp/auth/is-still-verified.ts +++ b/packages/backend/src/apps/smtp/auth/is-still-verified.ts @@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types'; import verifyCredentials from './verify-credentials'; const isStillVerified = async ($: IGlobalVariable) => { - try { - await verifyCredentials($); - return true; - } catch (error) { - return false; - } + await verifyCredentials($); + return true; }; export default isStillVerified; diff --git a/packages/backend/src/apps/twilio/auth/is-still-verified.ts b/packages/backend/src/apps/twilio/auth/is-still-verified.ts index 95a1ef29..66bb963e 100644 --- a/packages/backend/src/apps/twilio/auth/is-still-verified.ts +++ b/packages/backend/src/apps/twilio/auth/is-still-verified.ts @@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types'; import verifyCredentials from './verify-credentials'; const isStillVerified = async ($: IGlobalVariable) => { - try { - await verifyCredentials($); - return true; - } catch (error) { - return false; - } + await verifyCredentials($); + return true; }; export default isStillVerified; diff --git a/packages/backend/src/apps/twitter/auth/is-still-verified.ts b/packages/backend/src/apps/twitter/auth/is-still-verified.ts index 8f578344..d36919f2 100644 --- a/packages/backend/src/apps/twitter/auth/is-still-verified.ts +++ b/packages/backend/src/apps/twitter/auth/is-still-verified.ts @@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types'; import getCurrentUser from '../common/get-current-user'; const isStillVerified = async ($: IGlobalVariable) => { - try { - const user = await getCurrentUser($); - return !!user; - } catch (error) { - return false; - } + const user = await getCurrentUser($); + return !!user; }; export default isStillVerified; diff --git a/packages/backend/src/graphql/queries/test-connection.ts b/packages/backend/src/graphql/queries/test-connection.ts index 1fa4d036..3782b53e 100644 --- a/packages/backend/src/graphql/queries/test-connection.ts +++ b/packages/backend/src/graphql/queries/test-connection.ts @@ -22,7 +22,12 @@ const testConnection = async ( const app = await App.findOneByKey(connection.key, false); const $ = await globalVariable({ connection, app }); - const isStillVerified = await app.auth.isStillVerified($); + let isStillVerified; + try { + isStillVerified = !!(await app.auth.isStillVerified($)); + } catch { + isStillVerified = false; + } connection = await connection.$query().patchAndFetch({ formattedData: connection.formattedData,