Add notification when reloading stylesheets fails

This commit is contained in:
Kevin Sawicki
2015-04-14 16:10:56 -07:00
parent 63af011b38
commit fda6bb3624
2 changed files with 12 additions and 1 deletions

View File

@@ -28,6 +28,12 @@ describe "PackageManager", ->
expect(pack.metadata.name).toBe "package-with-invalid-styles"
expect(pack.stylesheets.length).toBe 0
addErrorHandler = jasmine.createSpy()
atom.notifications.onDidAddNotification(addErrorHandler)
expect(-> pack.reloadStylesheets()).not.toThrow()
expect(addErrorHandler.callCount).toBe 2
expect(addErrorHandler.argsForCall[1][0].message).toContain("Failed to reload the package-with-invalid-styles package stylesheets")
it "returns null if the package has an invalid package.json", ->
addErrorHandler = jasmine.createSpy()
atom.notifications.onDidAddNotification(addErrorHandler)

View File

@@ -371,7 +371,12 @@ class Package
reloadStylesheets: ->
oldSheets = _.clone(@stylesheets)
@loadStylesheets()
try
@loadStylesheets()
catch error
@handleError("Failed to reload the #{@name} package stylesheets", error)
@stylesheetDisposables?.dispose()
@stylesheetDisposables = new CompositeDisposable
@stylesheetsActivated = false