feat(logs): log endpoint errors for better debugging #1627
Conversation
|
@rfk r? |
|
Logs as: You can see what the EndpointError provides here VS what we send back to the user: |
| function logEndpointErrors(response, log) { | ||
| // When requests to DB timeout and fail for unknown reason they are an 'EndpointError'. | ||
| // The error response hides error information from the user, but we log it here | ||
| // to better understand the DB timeouts. |
philbooth
Jan 26, 2017
Contributor
Purely a naming thing but, in light of this comment, would something like DatabaseError or TimeoutError be a more accurate name for these?
Purely a naming thing but, in light of this comment, would something like DatabaseError or TimeoutError be a more accurate name for these?
vladikoff
Jan 26, 2017
Author
Contributor
hmm maybe, cases against the suggested though:
DatabaseError -> not exactly because customs server requests also use a pool, there is no "Database" there
TimeoutError -> not exactly because the pool can throw for different reasons.
It could be RequestError ?
hmm maybe, cases against the suggested though:
DatabaseError -> not exactly because customs server requests also use a pool, there is no "Database" there
TimeoutError -> not exactly because the pool can throw for different reasons.
It could be RequestError ?
philbooth
Jan 26, 2017
Contributor
Leave it as it is in that case I reckon, I was just going from the comment. I don't think there's much to choose between EndpointError and RequestError. 👍
Leave it as it is in that case I reckon, I was just going from the comment. I don't think there's much to choose between EndpointError and RequestError.
| describe('lib/server', () => { | ||
| describe('trimLocale', () => { | ||
| it('trims given locale', () => { | ||
| assert.equal(server._trimLocale(' fr-CH, fr;q=0.9 '), 'fr-CH, fr;q=0.9') |
vbudhram
Jan 26, 2017
Contributor
Mor coverage 👍
Mor coverage
| // log the DB attempt to understand the action | ||
| endpointLog.method = response.attempt.method | ||
| } | ||
| log.warn(endpointLog) |
vbudhram
Jan 26, 2017
Contributor
Is warn the right level here, or should it be error?
Is warn the right level here, or should it be error?
vladikoff
Jan 26, 2017
Author
Contributor
yea!
yea!
vladikoff
Jan 26, 2017
Author
Contributor
what i mean is yea! error is probably better here...
what i mean is yea! error is probably better here...

No description provided.