mirror of
https://github.com/Permissionless-Software-Foundation/psf-bch-api.git
synced 2026-09-21 16:52:00 -07:00
Merge pull request #22 from Permissionless-Software-Foundation/ct-unstable
fix(logs): Reducing log noise
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user