Skip to content

Commit

Permalink
fix the new error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
archaeron committed Aug 8, 2015
1 parent 4505e4e commit 33e6865
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

### Fixed

## v.0.2.2

### Added

### Fixed

- fix the new error messages

## v0.2.1

### Added
Expand Down
35 changes: 19 additions & 16 deletions lib/idris-ide-mode.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 33e6865

Please sign in to comment.