
I just released an eBook about exceptions and failure handling in Ruby - avdi
http://exceptionalruby.com/
======
telemachos
I'm loving the recent explosion in self-published books, but as a (general)
request: they are so, so much more useful when they come in multiple formats
(mobi, epub and pdf).

~~~
peterarmstrong
It's shameless self-promotion, but my startup Leanpub (<http://leanpub.com>)
lets you write in HTML or Markdown, embed external code samples, save your
files in Dropbox and produce PDF, EPUB and MOBI with one click. We sell all 3
formats, with automatic update distribution to existing readers when you
publish a new version (so you can sell your book while it's in progress). You
keep the rights to your book, etc.

~~~
StavrosK
Uh... That's actually awesome. I'll start writing a book now, and that's where
I'll publish it.

~~~
peterarmstrong
Great! Let me know how it's going, and if there's anything you need us to
improve...

~~~
StavrosK
I definitely will! Right now I just wish you supported LaTeX, though.

------
thmzlt
Here are the slides from the presentation on the same topic given by Avdi.

<http://avdi.org/talks/exceptional-ruby-2011-02-04/>

~~~
SpiralLab
Saw Avdi do this talk at Magic Ruby. It was really nice, and in depth, and
answered quite a few questions. I bet the book is well worth the money.

------
zizzler
Bought the book, found out Ruby has retry. Money well spent.

~~~
codenerdz
Wow, the timing could not be more perfect as Im trying to deal with a
validate_uniqueness race condition :)

~~~
tomfakes
validate_uniqueness is a system that is completely broken once you have more
than 1 ruby process running against the same database. It just can't work the
way you want it to.

You must add constraints to the database and handle the resulting exceptions
to ensure unique values.

They really need to kill validate_uniqueness since it is so totally broken

------
listrophy
After seeing Avdi talk about this at Ruby on Ales, I've started using `fail`
almost exclusively instead of `raise.`

It's the little things.

~~~
umjames
I quick check of the Ruby documentation (<http://www.ruby-doc.org/core/>)
suggests that raise and fail are the same method.

Is there an actual difference between these methods?

~~~
avdi
Nope! It's strictly a style issue. As I explain in the video (or the book if
you buy it), as a result of a conversation with Jim Weirich I'm starting to
use "fail" once again.

------
lucraft
Just read the sample pages and already learned something I am going to start
using.

------
mossity
is it too late to suggest an epigraph?

"Ever tried. Ever failed. No matter. Try again. Fail again. Fail better." -
Samuel Beckett

------
pbreit
Anything like this for Python?

~~~
jrockway

        try:
            your code
        except:
            handle the exception
        finally:
            clean up

~~~
avdi
That's all you'll find in my book, I just made the font really big and
quintuple-spaced it.

;-)

------
preek
"Check out the talk that that inspired the book" <\- Find the the redundancy.

~~~
preek
Now, if pointing out syntax errors on a commercial frontpage doesn't help the
author, then I don't know, guys.

------
jrockway
I want to read this book because I'm curious as to how you can stretch this
topic beyond two pages. But I don't want to pay $15 for that. Any ideas?

~~~
psyklic
"I think your book is crap. Give it to me for free?"

~~~
jrockway
Not what I said at all. I am honestly intrigued, but not because I care about
Ruby.

