     theme = pack.theme ? pack.metadata?.theme
     eventName = if theme then "theme-#{eventName}" else "package-#{eventName}"
     @emit eventName, pack, error
+
+createJsonParseError = (message, parseError, stdout) ->
+  error = new Error(message)
+  error.stdout = ''
+  error.stderr = "#{parseError.message}: #{stdout}"
+  error

        try
          packages = JSON.parse(stdout)
        catch parseError
          error = new Error('Fetching local packages failed.')
          error.stdout = ''
          error.stderr = parseError.message
          return callback(error)
        callback(null, packages)
      else

      if code is 0
        try
          packages = JSON.parse(stdout) ? []
        catch parseError
          error = createJsonParseError('Fetching outdated packages and themes failed.', parseError, stdout)
          return callback(error)

        callback(null, packages)
      else
