Main Menu

Fail-fast everywhere?

Started by LeoMaheo, March 23, 2009, 05:10:51 AM

Previous topic - Next topic

LeoMaheo

Hi!

Perhaps I'm being a bit pedantic, but:

I'd suggest that Matrix.setDump throw a RuntimeException if the passed float[] is not 16 elements,
instead of silently doing nothing?
(I lost a few minutes debugging my code.)

Fail-fast is the way to go, I believe.

Actually, I'd appreciate it if all functions threw RuntimeExceptions as quickly as possible,
when invoked with illegal input.

(Possibly this is even more important with closed source products,
since you cannot always tell from studying source code
how they functions internally and how they react to invalid input.)

Kind regards,
Magnus

EgonOlsen

Just do a


Logger.setOnError(Logger.ON_ERROR_THROW_EXCEPTION );


and you'll get Exceptions in those cases that i consider to be errors.

LeoMaheo

Oh, thanks for the information :-)
Works fine (well of course)