From 33e68655c5a3cd7924974bb3eb973631b6e82acf Mon Sep 17 00:00:00 2001 From: Nicolas Gagliani Date: Sat, 8 Aug 2015 23:16:45 +0200 Subject: [PATCH] fix the new error messages --- CHANGELOG.md | 8 ++++++++ lib/idris-ide-mode.coffee | 35 +++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4045266..aed4b00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ ### Fixed +## v.0.2.2 + +### Added + +### Fixed + +- fix the new error messages + ## v0.2.1 ### Added diff --git a/lib/idris-ide-mode.coffee b/lib/idris-ide-mode.coffee index 5e58a94..b992178 100644 --- a/lib/idris-ide-mode.coffee +++ b/lib/idris-ide-mode.coffee @@ -12,10 +12,10 @@ class IdrisIdeMode extends EventEmitter constructor: -> pathToIdris = atom.config.get("language-idris.pathToIdris") @process = spawn pathToIdris, ['--ide-mode'] - @process.on 'exit', @stopped - @process.on 'error', @stopped - @process.on 'close', @stopped - @process.on 'disconnect', @stopped + @process.on 'error', @error + @process.on 'exit', @exited + @process.on 'close', @exited + @process.on 'disconnect', @exited @process.stdout.setEncoding('utf8').on 'data', @stdout @@ -25,23 +25,26 @@ class IdrisIdeMode extends EventEmitter stop: -> @process?.kill() - @stopped() - stopped: (error, signal) => + error: (error) -> e = - if error - if error.code == 'ENOENT' - short: "Couldn't find idris executable" - long: "Couldn't find idris executable at \"#{error.path}\"" - else - short: error.code - long: error.message + if error.code == 'ENOENT' + short: "Couldn't find idris executable" + long: "Couldn't find idris executable at \"#{error.path}\"" else - short: signal - long: "Process exited with signal #{signal}" + short: error.code + long: error.message atom.notifications.addError e.short, detail: e.long - @process = null + + exited: (code, signal) -> + short = "The idris compiler was closed or crashed" + long = + if signal + "It was closed with the signal: #{signal}" + else + "It (probably) crashed with the error code: #{code}" + atom.notifications.addError short, detail: long running: -> !!@process