fail

Hi

Maybe I wrote about that already, perhaps I didn't get any answer:

How can I fail with _only_ a nice message? - I don't want any
backtrace,... (nice output!)

thanks Opti

Quoting Die Optimisten (inform@die-optimisten.net):

How can I fail with _only_ a nice message? - I don't want any
backtrace,... (nice output!)

If you fail, you must have a sufficiently alarming message, including
backtrace. It is of course possible to trap errors at any point aqnd
make them disappear with something like

begin
  action
rescue
  puts("Nice output")
end

but I would never suggest this approach. What you seem to have
are acceptable conditions where different outcomes may be expected. In
this case, I would properly code the various outcomes, not use
exceptions.

Carlo

···

Subject: fail
  Date: Mon 09 Aug 21 02:00:54PM +0200

--
  * Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
  * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

abort("some nice message")

···

On Mon, Aug 9, 2021 at 2:01 PM Die Optimisten <inform@die-optimisten.net> wrote:

Hi

Maybe I wrote about that already, perhaps I didn't get any answer:

How can I fail with _only_ a nice message? - I don't want any
backtrace,... (nice output!)

thanks Opti

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<ruby-talk list: member options login page>

--
[guy, jim, charlie, sho].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/