Skip to content

Commit

Permalink
Fixes #12 - Changed Validation.create error log level to verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
pkcs8 committed Aug 16, 2022
1 parent 5ddcf25 commit e29c645
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dotenv": "^16.0.1",
"express": "^4.18.1",
"grpc-tools": "^1.11.2",
"mongodb": "^4.8.1",
"mongoose": "^6.4.4",
"morgan": "^1.10.0",
"node-fetch": "^2.6.7",
Expand Down
8 changes: 6 additions & 2 deletions src/processors/Ingress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Validation from '../models/Validation'
import xrplclient from '../services/xrpl'
import logger from '../logger'
import ENV from '../lib/ENV'
import { MongoServerError } from 'mongodb'

const LOGPREFIX = '[ingress]'

Expand All @@ -18,8 +19,11 @@ const ingress = async () => {
try {
await Validation.create(validation)
} catch (error) {
if (error instanceof Error) {
logger.warn(LOGPREFIX, `${error}`)
if (error instanceof MongoServerError && error.code === 11000) {
logger.verbose(LOGPREFIX, `${error}`)
}
else {
logger.error(LOGPREFIX, `${error}`)
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ mongodb-connection-string-url@^2.5.2:
"@types/whatwg-url" "^8.2.1"
whatwg-url "^11.0.0"

[email protected]:
[email protected], mongodb@^4.8.1:
version "4.8.1"
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-4.8.1.tgz#596de88ff4519128266d9254dbe5b781c4005796"
integrity sha512-/NyiM3Ox9AwP5zrfT9TXjRKDJbXlLaUDQ9Rg//2lbg8D2A8GXV0VidYYnA/gfdK6uwbnL4FnAflH7FbGw3TS7w==
Expand Down

0 comments on commit e29c645

Please sign in to comment.