Gaëtan Renaudeau
6 years ago
No known key found for this signature in database
GPG Key ID: 7B66B85F042E5451
2 changed files with
5 additions and
2 deletions
-
src/api/network.js
-
src/logger/logger.js
|
|
@ -6,7 +6,7 @@ import logger from 'logger' |
|
|
|
import { LedgerAPIErrorWithMessage, LedgerAPIError, NetworkDown } from 'config/errors' |
|
|
|
import anonymizer from 'helpers/anonymizer' |
|
|
|
|
|
|
|
const userFriendlyError = <A>(p: Promise<A>, { url, method, startTime }): Promise<A> => |
|
|
|
const userFriendlyError = <A>(p: Promise<A>, { url, method, startTime, ...rest }): Promise<A> => |
|
|
|
p.catch(error => { |
|
|
|
let errorToThrow |
|
|
|
if (error.response) { |
|
|
@ -47,6 +47,7 @@ const userFriendlyError = <A>(p: Promise<A>, { url, method, startTime }): Promis |
|
|
|
}) |
|
|
|
} |
|
|
|
logger.networkError({ |
|
|
|
...rest, |
|
|
|
status, |
|
|
|
url, |
|
|
|
method, |
|
|
@ -80,6 +81,7 @@ let implementation = (arg: Object) => { |
|
|
|
const meta = { |
|
|
|
url: arg.url, |
|
|
|
method: arg.method, |
|
|
|
data: arg.data, |
|
|
|
startTime: Date.now(), |
|
|
|
} |
|
|
|
logger.network(meta) |
|
|
|
|
|
@ -273,6 +273,7 @@ export default { |
|
|
|
status, |
|
|
|
error, |
|
|
|
responseTime, |
|
|
|
...rest |
|
|
|
}: { |
|
|
|
method: string, |
|
|
|
url: string, |
|
|
@ -285,7 +286,7 @@ export default { |
|
|
|
0, |
|
|
|
)}ms` |
|
|
|
if (logNetwork) { |
|
|
|
logger.log('info', log, { type: 'network-error', status, method }) |
|
|
|
logger.log('info', log, { type: 'network-error', status, method, ...rest }) |
|
|
|
} |
|
|
|
captureBreadcrumb({ |
|
|
|
category: 'network', |
|
|
|