Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #829 from atom/ns-as-fix-update-error-handler
Browse files Browse the repository at this point in the history
Avoid throwing null pointer exceptions when package update fails
  • Loading branch information
Nathan Sobo committed Aug 10, 2016
2 parents 074ea2b + a7df3b2 commit 70fdb1b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/package-card.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,20 @@ class PackageCard extends View

update: ->
return unless @newVersion or @newSha
@packageManager.update @installablePack ? @pack, @newVersion, (error) =>
pack = @installablePack ? @pack
version = if @newVersion then "v#{@newVersion}" else "##{@newSha.substr(0, 8)}"
@packageManager.update pack, @newVersion, (error) =>
if error?
version = if @newVersion then "v#{newVersion}" else "##{@newSha.substr(0, 8)}"
console.error("Updating #{@type} #{@pack.name} to #{version} failed", error.stack ? error, error.stderr)
atom.assert false, "Package update failed", (assertionError) =>
assertionError.metadata = {
type: @type,
name: pack.name,
version: version,
errorMessage: error.message,
errorStack: error.stack,
errorStderr: error.stderr
}
console.error("Updating #{@type} #{pack.name} to #{version} failed:\n", error, error.stderr ? '')

uninstall: ->
@packageManager.uninstall @pack, (error) =>
Expand Down

0 comments on commit 70fdb1b

Please sign in to comment.