Kid Binary Kid Binary - 2 months ago 8
Javascript Question

Hacking Atom editor - how to throw atom-style exception from custom plugin?

I'm developing a plugin for a GitHub Atom editor, and I need to throw an Exception in case of plugin's misconfiguration (or internal error).

I want them to appear in the top right corner, as standard Atom error widget, but I can't find any clue about it in the Web.

Doing simple

throw Error('...');
is not handled by the editor, and produces only console output.

Maybe someone did this?

Answer

The api call to do this is:

atom.notifications.addError('string to display in error message')

if you are developing the plugin in node.js.

If you are using Coffeescript, then I would guess it would be the same but with a syntax change for node.js versus Coffeescript.

Comments