mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Handle errors in package.json gracefully
This commit is contained in:
@@ -19,6 +19,10 @@ describe "the `atom` global", ->
|
||||
expect(object.data).toBe 5
|
||||
expect(pack.activateStylesheets).toHaveBeenCalled()
|
||||
|
||||
it "continues if the package fails to load", ->
|
||||
config.set("core.disabledPackages", [])
|
||||
expect(-> atom.loadPackage("package-that-throws-on-load")).not.toThrow()
|
||||
|
||||
describe ".unloadPackage(name)", ->
|
||||
describe "when the package is active", ->
|
||||
it "throws an error", ->
|
||||
|
||||
1
spec/fixtures/packages/package-that-throws-on-load/package.json
vendored
Normal file
1
spec/fixtures/packages/package-that-throws-on-load/package.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
INVALID
|
||||
@@ -63,7 +63,7 @@ beforeEach ->
|
||||
config.set "editor.fontFamily", "Courier"
|
||||
config.set "editor.fontSize", 16
|
||||
config.set "editor.autoIndent", false
|
||||
config.set "core.disabledPackages", ["package-that-throws-an-exception"]
|
||||
config.set "core.disabledPackages", ["package-that-throws-an-exception", "package-that-throws-on-load"]
|
||||
config.save.reset()
|
||||
atom.config = config
|
||||
window.config = config
|
||||
|
||||
@@ -66,8 +66,9 @@ class PackageManager
|
||||
|
||||
if packagePath = @resolvePackagePath(name)
|
||||
return pack if pack = @getLoadedPackage(name)
|
||||
|
||||
pack = Package.load(packagePath, options)
|
||||
if pack.metadata.theme
|
||||
if pack.metadata?.theme
|
||||
atom.themes.register(pack)
|
||||
else
|
||||
@loadedPackages[pack.name] = pack
|
||||
|
||||
Reference in New Issue
Block a user