Skip to content

Commit

Permalink
Fix errors.json logging empty errors
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Sep 13, 2023
1 parent c75e20e commit 618d101
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/sync-changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const EventEmitter = require('events')
const browserSync = require('browser-sync')
const { ensureDirSync, writeJsonSync } = require('fs-extra')
const path = require('path')
const util = require('util')
const { tmpDir } = require('./utils/paths')
const fs = require('fs')

Expand All @@ -20,9 +21,15 @@ function hasRestartedAfterError () {

function flagError(error) {
const errorPath = path.join(tmpDir, 'errors.json')
const errorFormatted = util.inspect(error, {
compact: false,
depth: Infinity,
maxArrayLength: Infinity,
maxStringLength: Infinity
})

ensureDirSync(path.dirname(errorPath))
writeJsonSync(errorPath, { error })
writeJsonSync(errorPath, { error: errorFormatted })
}

function unflagError () {
Expand Down

0 comments on commit 618d101

Please sign in to comment.