fix(logs): Reducing log noise

This commit is contained in:
Chris Troutner
2026-03-16 20:51:33 -07:00
parent a959416b10
commit 91f99405c1
3 changed files with 37 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
# 2026-03-16 Update Log
## Summary
Reduced noisy error logging for common SLP transaction misses in the `/v6/slp/txid` path.
## Changes Made
- Updated `src/use-cases/slp-use-cases.js` in `getTxid()`:
- Added a guard for expected missing-record errors (`404` + `Key not found in database`).
- Skips `wlogger.error()` for that specific, common case.
- Still rethrows the error so API response behavior is unchanged.
- Updated `src/controllers/rest-api/slp/controller.js` in `handleError()`:
- Added the same guard to suppress duplicate error-level logs for the same expected case.
- Keeps normal error logging for all other errors.
## Outcome
- The common "Key not found in database" case no longer pollutes error logs.
- Unexpected failures continue to be logged at error level.
- Client-facing status and error message behavior remains unchanged.
@@ -208,7 +208,14 @@ class SlpRESTController {
}
handleError (err, res) {
const isCommonMissingTxError =
err?.status === 404 &&
typeof err?.message === 'string' &&
err.message.includes('Key not found in database')
if (!isCommonMissingTxError) {
wlogger.error('Error in SlpRESTController:', err)
}
const status = err.status || 500
const message = err.message || 'Internal server error'
+7
View File
@@ -98,7 +98,14 @@ class SlpUseCases {
try {
return await this.slpIndexer.post('slp/tx/', { txid })
} catch (err) {
const isCommonMissingTxError =
err?.status === 404 &&
typeof err?.message === 'string' &&
err.message.includes('Key not found in database')
if (!isCommonMissingTxError) {
wlogger.error('Error in SlpUseCases.getTxid()', err)
}
throw err
}
}