-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 02 November 2010, Jeff Johnson <n3...@mac.com> wrote: > There's enough regularity (imho) that one could attempt > some #define's to throw exceptions for non zero return codes > if that's what you wish. I tend to find exceptions a pain > because I have to wrap everything I do with exception handlers > and because I'm a C, not a ruby, developer.
I don't see the difference between if mc.add 'foo', 'bar' then use_that_macro end and begin mc.add 'foo', 'bar' rescue RPM::Error # ... end - From the Ruby perspective, of course. And I guess there's a misunderstanding about *where* I want to catch/throw exceptions: > > So what's the plan for this particular problem? Do sanitation and error > > handling in the bindings code? > > Plan for what? Exception handling? There's already a TRY ... CATCH > frameeork based in setjmp/longjmp that was added with the mongo-c-driver > last month. I'd like to throw *Ruby exceptions* in the C code whenever the underlying C code signals me that there's an error. This is what I meant with "translating idiosyncracies." > Hint: rpmlog is just a #define (or static inline function I fergit). > If you get the default carried by rpm includes out of the way carefully, > you can just overload throwing an exception into rpmlog() itself). Way to go! That beats duplicating validation code. :-) > >> Strings, not Yet More stoopid enumerations, are what is needed, with > >> some simple rules on how the string should be constructed like > >> syslog(3), are simplest for passing to applications/bindings. > > > > You mean returning/passing around error strings instead of error codes? > > structured error strings that can be parsed with a pattern easily, > but otherwise yes. The maintenance pain is from creating all > the structures/enums/defines/whatever for errors. But its quite easy > to follow a structured error string discipline, like e.g. > danger:wtf:here's the details > using a ':' separator and 3 string sub-fields without > explaining/documenting what "wtf" really means ;-) I, personally, loathe strings as a means to transport errors internally. I'm largely influenced by posts like this one <http://www.modernperlbooks.com/mt/2010/07/dont-parse-that-string.html>. But I'll use whatever is there in RPM5. Eric Wrapping Spec_s::packages into Ruby classes. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkzPZc4ACgkQhS0drJ3goJLmlQCcCMuj2Fev5HSmIx5QniXwob1i SwIAniTBfoJJFM64v+TyuJObrj5ICXNd =7Be4 -----END PGP SIGNATURE----- ______________________________________________________________________ RPM Package Manager http://rpm5.org Developer Communication List rpm-devel@rpm5.org