Skip to content

Commit

Permalink
Error cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chasers committed Jun 30, 2021
1 parent d1eb113 commit c29f1a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions pages/api/error-pino-logflare.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import logger from '../../logger/logger'

export default function handler(req, res) {

// Lets log an error with console here.
// Lets log an error with pino-logflare here.
try {
throw new Error('Whoops!')
throw new Error('Whoops! Error with pino-logflare.')
} catch (e) {
const onlyPino = require('pino')()

onlyPino.error(e)
logger.error(e)
}

res.status(200).json({ error: 'true' })
Expand Down
4 changes: 2 additions & 2 deletions pages/api/error-pino.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import logger from '../../logger/logger'

export default function handler(req, res) {

// Lets log an error with console here.
// Lets log an error with pino here.
try {
throw new Error('Whoops!')
throw new Error('Whoops! Error with pino.')
} catch (e) {
const onlyPino = require('pino')()

Expand Down

0 comments on commit c29f1a1

Please sign in to comment.