From 944b166e43984b3533cf4ae07297776d57fc178e Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 31 Oct 2021 12:38:42 +0100 Subject: [PATCH] Added explicit any type on caught errors where needed --- src/api/services/ShlinkApiClient.ts | 2 +- src/domains/reducers/domainRedirects.ts | 2 +- src/domains/reducers/domainsList.ts | 2 +- src/short-urls/reducers/shortUrlCreation.ts | 2 +- src/short-urls/reducers/shortUrlDeletion.ts | 2 +- src/short-urls/reducers/shortUrlDetail.ts | 2 +- src/short-urls/reducers/shortUrlEdition.ts | 2 +- src/tags/reducers/tagDelete.ts | 2 +- src/tags/reducers/tagEdit.ts | 2 +- src/tags/reducers/tagsList.ts | 2 +- src/visits/reducers/common.ts | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/api/services/ShlinkApiClient.ts b/src/api/services/ShlinkApiClient.ts index 315be26b..f724b43a 100644 --- a/src/api/services/ShlinkApiClient.ts +++ b/src/api/services/ShlinkApiClient.ts @@ -125,7 +125,7 @@ export default class ShlinkApiClient { data: body, paramsSerializer: stringifyQuery, }); - } catch (e) { + } catch (e: any) { const { response } = e; // Due to a bug on all previous Shlink versions, requests to non-matching URLs will always result on a CORS error diff --git a/src/domains/reducers/domainRedirects.ts b/src/domains/reducers/domainRedirects.ts index 5b350a13..a0969aea 100644 --- a/src/domains/reducers/domainRedirects.ts +++ b/src/domains/reducers/domainRedirects.ts @@ -27,7 +27,7 @@ export const editDomainRedirects = (buildShlinkApiClient: ShlinkApiClientBuilder const redirects = await editDomainRedirects({ domain, ...domainRedirects }); dispatch({ type: EDIT_DOMAIN_REDIRECTS, domain, redirects }); - } catch (e) { + } catch (e: any) { dispatch({ type: EDIT_DOMAIN_REDIRECTS_ERROR, errorData: parseApiError(e) }); } }; diff --git a/src/domains/reducers/domainsList.ts b/src/domains/reducers/domainsList.ts index 910c2db5..c8ee513d 100644 --- a/src/domains/reducers/domainsList.ts +++ b/src/domains/reducers/domainsList.ts @@ -71,7 +71,7 @@ export const listDomains = (buildShlinkApiClient: ShlinkApiClientBuilder) => () const domains = await listDomains(); dispatch({ type: LIST_DOMAINS, domains }); - } catch (e) { + } catch (e: any) { dispatch({ type: LIST_DOMAINS_ERROR, errorData: parseApiError(e) }); } }; diff --git a/src/short-urls/reducers/shortUrlCreation.ts b/src/short-urls/reducers/shortUrlCreation.ts index 12c3ae46..940612d1 100644 --- a/src/short-urls/reducers/shortUrlCreation.ts +++ b/src/short-urls/reducers/shortUrlCreation.ts @@ -49,7 +49,7 @@ export const createShortUrl = (buildShlinkApiClient: ShlinkApiClientBuilder) => const result = await createShortUrl(data); dispatch({ type: CREATE_SHORT_URL, result }); - } catch (e) { + } catch (e: any) { dispatch({ type: CREATE_SHORT_URL_ERROR, errorData: parseApiError(e) }); throw e; diff --git a/src/short-urls/reducers/shortUrlDeletion.ts b/src/short-urls/reducers/shortUrlDeletion.ts index 2530c153..952d0e99 100644 --- a/src/short-urls/reducers/shortUrlDeletion.ts +++ b/src/short-urls/reducers/shortUrlDeletion.ts @@ -48,7 +48,7 @@ export const deleteShortUrl = (buildShlinkApiClient: ShlinkApiClientBuilder) => try { await deleteShortUrl(shortCode, domain); dispatch({ type: SHORT_URL_DELETED, shortCode, domain }); - } catch (e) { + } catch (e: any) { dispatch({ type: DELETE_SHORT_URL_ERROR, errorData: parseApiError(e) }); throw e; diff --git a/src/short-urls/reducers/shortUrlDetail.ts b/src/short-urls/reducers/shortUrlDetail.ts index f338e2c7..d504fdae 100644 --- a/src/short-urls/reducers/shortUrlDetail.ts +++ b/src/short-urls/reducers/shortUrlDetail.ts @@ -50,7 +50,7 @@ export const getShortUrlDetail = (buildShlinkApiClient: ShlinkApiClientBuilder) ) ?? await buildShlinkApiClient(getState).getShortUrl(shortCode, domain); dispatch({ shortUrl, type: GET_SHORT_URL_DETAIL }); - } catch (e) { + } catch (e: any) { dispatch({ type: GET_SHORT_URL_DETAIL_ERROR, errorData: parseApiError(e) }); } }; diff --git a/src/short-urls/reducers/shortUrlEdition.ts b/src/short-urls/reducers/shortUrlEdition.ts index 8777dd47..3a27da08 100644 --- a/src/short-urls/reducers/shortUrlEdition.ts +++ b/src/short-urls/reducers/shortUrlEdition.ts @@ -55,7 +55,7 @@ export const editShortUrl = (buildShlinkApiClient: ShlinkApiClientBuilder) => ( ]); dispatch({ shortUrl, type: SHORT_URL_EDITED }); - } catch (e) { + } catch (e: any) { dispatch({ type: EDIT_SHORT_URL_ERROR, errorData: parseApiError(e) }); throw e; diff --git a/src/tags/reducers/tagDelete.ts b/src/tags/reducers/tagDelete.ts index 8a3664dd..5b38722d 100644 --- a/src/tags/reducers/tagDelete.ts +++ b/src/tags/reducers/tagDelete.ts @@ -44,7 +44,7 @@ export const deleteTag = (buildShlinkApiClient: ShlinkApiClientBuilder) => (tag: try { await deleteTags([ tag ]); dispatch({ type: DELETE_TAG }); - } catch (e) { + } catch (e: any) { dispatch({ type: DELETE_TAG_ERROR, errorData: parseApiError(e) }); throw e; diff --git a/src/tags/reducers/tagEdit.ts b/src/tags/reducers/tagEdit.ts index d28f0838..ddaa2fed 100644 --- a/src/tags/reducers/tagEdit.ts +++ b/src/tags/reducers/tagEdit.ts @@ -59,7 +59,7 @@ export const editTag = (buildShlinkApiClient: ShlinkApiClientBuilder, colorGener await editTag(oldName, newName); colorGenerator.setColorForKey(newName, color); dispatch({ type: EDIT_TAG, oldName, newName }); - } catch (e) { + } catch (e: any) { dispatch({ type: EDIT_TAG_ERROR, errorData: parseApiError(e) }); throw e; diff --git a/src/tags/reducers/tagsList.ts b/src/tags/reducers/tagsList.ts index 90bef1b1..5859f818 100644 --- a/src/tags/reducers/tagsList.ts +++ b/src/tags/reducers/tagsList.ts @@ -126,7 +126,7 @@ export const listTags = (buildShlinkApiClient: ShlinkApiClientBuilder, force = t }, {}); dispatch({ tags, stats: processedStats, type: LIST_TAGS }); - } catch (e) { + } catch (e: any) { dispatch({ type: LIST_TAGS_ERROR, errorData: parseApiError(e) }); } }; diff --git a/src/visits/reducers/common.ts b/src/visits/reducers/common.ts index 1fd42d02..4e43445b 100644 --- a/src/visits/reducers/common.ts +++ b/src/visits/reducers/common.ts @@ -72,7 +72,7 @@ export const getVisitsWithLoader = async & { visits: V const visits = await loadVisits(); dispatch({ ...extraFinishActionData, visits, type: actionMap.finish }); - } catch (e) { + } catch (e: any) { dispatch({ type: actionMap.error, errorData: parseApiError(e) }); } };