From 85177d3ddd053b4c191af83d025ad9309b8ef7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Fri, 27 Sep 2019 12:35:13 +0200 Subject: [PATCH] Refactor error messages --- src/logic/safe/transactions/gas.js | 6 ++---- src/logic/safe/utils/safeStorage.js | 6 ++---- src/logic/tokens/store/actions/fetchTokens.js | 3 +-- src/logic/tokens/utils/tokensStorage.js | 6 ++---- src/routes/load/container/Load.jsx | 3 +-- .../Settings/ManageOwners/AddOwnerModal/index.jsx | 3 +-- .../Settings/ManageOwners/ReplaceOwnerModal/index.jsx | 3 +-- src/utils/storage/signatures.js | 3 +-- src/utils/storage/transactions.js | 3 +-- 9 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/logic/safe/transactions/gas.js b/src/logic/safe/transactions/gas.js index 1ae8e0d0..2a0da8cb 100644 --- a/src/logic/safe/transactions/gas.js +++ b/src/logic/safe/transactions/gas.js @@ -82,8 +82,7 @@ export const generateTxGasEstimateFrom = async ( // Add 10k else we will fail in case of nested calls return txGasEstimate.toNumber() + 10000 } catch (error) { - // eslint-disable-next-line - console.log('Error calculating tx gas estimation ' + error) + console.error('Error calculating tx gas estimation', error) return 0 } } @@ -128,8 +127,7 @@ export const calculateTxFee = async ( return estimate } catch (error) { - // eslint-disable-next-line - console.log('Error calculating tx gas estimation ' + error) + console.error('Error calculating tx gas estimation', error) return 0 } } diff --git a/src/logic/safe/utils/safeStorage.js b/src/logic/safe/utils/safeStorage.js index da498908..c8e092d0 100644 --- a/src/logic/safe/utils/safeStorage.js +++ b/src/logic/safe/utils/safeStorage.js @@ -22,8 +22,7 @@ export const saveSafes = async (safes: Object) => { try { await saveToStorage(SAFES_KEY, safes) } catch (err) { - // eslint-disable-next-line - console.log('Error storing safe info in localstorage') + console.error('Error storing safe info in localstorage', err) } } @@ -32,8 +31,7 @@ export const setOwners = async (safeAddress: string, owners: List) => { const ownersAsMap = Map(owners.map((owner: Owner) => [owner.address.toLowerCase(), owner.name])) await saveToStorage(`${OWNERS_KEY}-${safeAddress}`, ownersAsMap) } catch (err) { - // eslint-disable-next-line - console.log('Error storing owners in localstorage') + console.error('Error storing owners in localstorage', err) } } diff --git a/src/logic/tokens/store/actions/fetchTokens.js b/src/logic/tokens/store/actions/fetchTokens.js index d3654f96..abaad8bc 100644 --- a/src/logic/tokens/store/actions/fetchTokens.js +++ b/src/logic/tokens/store/actions/fetchTokens.js @@ -40,8 +40,7 @@ export const fetchTokens = () => async (dispatch: ReduxDispatch) => dispatch(saveTokens(tokens)) } catch (err) { - // eslint-disable-next-line - console.log('Error fetching token list ' + err) + console.error('Error fetching token list', err) return Promise.resolve() } diff --git a/src/logic/tokens/utils/tokensStorage.js b/src/logic/tokens/utils/tokensStorage.js index 0016ebbb..ec1785c8 100644 --- a/src/logic/tokens/utils/tokensStorage.js +++ b/src/logic/tokens/utils/tokensStorage.js @@ -14,8 +14,7 @@ export const saveActiveTokens = async (tokens: Map) => { try { await saveToStorage(ACTIVE_TOKENS_KEY, tokens.toJS()) } catch (err) { - // eslint-disable-next-line - console.log('Error storing tokens in localstorage') + console.error('Error storing tokens in localstorage', err) } } @@ -38,8 +37,7 @@ export const removeTokenFromStorage = async (safeAddress: string, token: Token) const index = data.indexOf(token) await saveToStorage(CUSTOM_TOKENS_KEY, data.remove(index)) } catch (err) { - // eslint-disable-next-line - console.log('Error removing token in localstorage') + console.error('Error removing token in localstorage', err) } } diff --git a/src/routes/load/container/Load.jsx b/src/routes/load/container/Load.jsx index 86d3b6b3..181d0ec8 100644 --- a/src/routes/load/container/Load.jsx +++ b/src/routes/load/container/Load.jsx @@ -50,8 +50,7 @@ class Load extends React.Component { const url = `${SAFELIST_ADDRESS}/${safeAddress}` history.push(url) } catch (error) { - // eslint-disable-next-line - console.log('Error while loading the Safe' + error) + console.error('Error while loading the Safe', error) } } diff --git a/src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/index.jsx b/src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/index.jsx index 4766623f..008a7beb 100644 --- a/src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/index.jsx @@ -117,8 +117,7 @@ const AddOwner = ({ try { sendAddOwner(values, safeAddress, owners, enqueueSnackbar, closeSnackbar, createTransaction, addSafeOwner) } catch (error) { - // eslint-disable-next-line - console.log('Error while removing an owner ' + error) + console.error('Error while removing an owner', error) } } diff --git a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.jsx b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.jsx index effb19c0..5de4cd97 100644 --- a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.jsx @@ -123,8 +123,7 @@ const ReplaceOwner = ({ replaceSafeOwner, ) } catch (error) { - // eslint-disable-next-line - console.log('Error while removing an owner ' + error) + console.error('Error while removing an owner', error) } } diff --git a/src/utils/storage/signatures.js b/src/utils/storage/signatures.js index 2708cb98..a7cf5d3c 100644 --- a/src/utils/storage/signatures.js +++ b/src/utils/storage/signatures.js @@ -15,8 +15,7 @@ export const storeSignature = async (safeAddress: string, nonce: number, signatu const updatedSubjects = subjects.set(key, signatures) await saveToStorage(signaturesKey, updatedSubjects) } catch (err) { - // eslint-disable-next-line - console.log('Error storing signatures in localstorage') + console.error('Error storing signatures in localstorage', err) } } diff --git a/src/utils/storage/transactions.js b/src/utils/storage/transactions.js index ec29e002..5aca3d26 100644 --- a/src/utils/storage/transactions.js +++ b/src/utils/storage/transactions.js @@ -12,8 +12,7 @@ export const storeSubject = async (safeAddress: string, nonce: number, subject: const updatedSubjects = subjects.set(nonce, subject) saveToStorage(key, updatedSubjects) } catch (err) { - // eslint-disable-next-line - console.log('Error storing transaction subject in localstorage') + console.error('Error storing transaction subject in localstorage', err) } }