       if code is 0
         try
           packages = JSON.parse(stdout) ? []
-        catch error
-          callback(error)
-          return
+        catch parseError
+          error = createJsonParseError("Fetching package '#{packageName}' failed.", parseError, stdout)
+          return callback(error)
 
         callback(null, packages)
       else

      if code is 0
        try
          packages = JSON.parse(stdout) ? []
        catch error
          callback(error)
          return

        callback(null, packages)
      else

    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
