阅读背景:

更好地终止()或提高()在Ruby中的参数错误?

来源:互联网 

I'm writing a command-line utility in Ruby and coding the logic that checks whether the combination of arguments is valid. If I find an error, what is the advantage of raising an ArgumentError vs. calling abort() on the spot if I don't intend to recover? In general, when is it advisable to raise an exception instead of aborting if there are no plans to attempt recovery? I'd assume that the exception route is advisable is some kind of graceful shut-down is needed instead of simply dropping back to the command line.I'm writing a command-line utility in Ruby and




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: