Skip to content

Commit

Permalink
Add option to ignore exceptions
Browse files Browse the repository at this point in the history
Shows exceptions, dump a trace but do not exit process
if option is true.
  • Loading branch information
automata committed Nov 24, 2015
1 parent d8a1e98 commit d2fc3e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ parse = (args) ->
.option('--deadletter <in1,in2>', 'Set up deadlettering queues for the named inport', String, '')
.option('--attr key.subkey=value', 'Additional attributes', addOption, [])
.option('--trace [true]', 'Enable tracing with Flowtrace', Boolean, false)
.option('--ignore-exceptions [false]', 'Do not exit process when caught exceptions', Boolean, false)
.parse args

delete program.options # not clone()able
Expand All @@ -29,7 +30,7 @@ main = ->
console.log "Stack trace: #{error.stack}" if error.stack
m.tracer.dumpFile null, (err, fname) ->
console.log 'Wrote flowtrace to:', fname
process.exit(2)
process.exit(2) if not options.ignoreExceptions

process.on 'SIGUSR2', () =>
return console.log 'ERROR: Tracing not enabled' if not options.trace
Expand Down

2 comments on commit d2fc3e1

@jonnor
Copy link
Member

@jonnor jonnor commented on d2fc3e1 Nov 24, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@automata Did you test this? commander is sometimes a bit tricky to get to parse right

@automata
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked on commander docs, but hey, maybe it's better to add test for it first.

Please sign in to comment.