www.jpct.net

General => Feedback => Topic started by: LeoMaheo on March 23, 2009, 05:10:51 am

Title: Fail-fast everywhere?
Post by: LeoMaheo on March 23, 2009, 05:10:51 am
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
Title: Re: Fail-fast everywhere?
Post by: EgonOlsen on March 23, 2009, 10:44:20 am
Just do a

Code: [Select]
Logger.setOnError(Logger.ON_ERROR_THROW_EXCEPTION );

and you'll get Exceptions in those cases that i consider to be errors.
Title: Re: Fail-fast everywhere?
Post by: LeoMaheo on March 23, 2009, 05:53:35 pm
Oh, thanks for the information :-)
Works fine (well of course)