choirulz / base2

Automatically exported from code.google.com/p/base2
0 stars 0 forks source link

More exceptions targetted at library users #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I ran into a weird problem, see attached cases.

I got different error messages when I used the normal and the packed
version of base2. After some debugging, I realized I made an error with
instantiating a class.

Although I learned more about the inner workings of base2, most people
using base2 just want to get their work done. Therefor I suggest adding
some assertions at the top-level of the API, giving library users some more
clues (call it API usability).

Note: this is not a bug for packer, although in firebug it looks like that.

Original issue reported on code.google.com by doek...@gmail.com on 18 May 2007 at 8:05

Attachments:

GoogleCodeExporter commented 9 years ago
Throwing specific exceptions, will aid users. 

For example: instead of "Duplicate key." (Collection.add), specify the 
duplicate key,
like: "Key %1 is duplicate".

Original comment by doek...@gmail.com on 9 Jun 2007 at 7:08

GoogleCodeExporter commented 9 years ago
I'm assigning this to you now that you have commit rights. ;-)

Original comment by dean.edw...@gmail.com on 10 Jul 2007 at 2:56

GoogleCodeExporter commented 9 years ago

Original comment by doek...@gmail.com on 14 Jul 2007 at 7:06

GoogleCodeExporter commented 9 years ago

Original comment by dean.edw...@gmail.com on 14 Jul 2007 at 10:03

GoogleCodeExporter commented 9 years ago
Can you provide some more examples of the kinds of places that I should put 
assertions?

Original comment by dean.edw...@gmail.com on 23 Jul 2007 at 9:05

GoogleCodeExporter commented 9 years ago
I have to think about this (I can't think of a concrete example).

But when creating an object without enough arguments, fire-fox gives you very 
scary exceptions. And because 
of that, checking the arguments is not the first thing someone (at least 
myself) would check first.

Original comment by doek...@gmail.com on 23 Jul 2007 at 5:15

GoogleCodeExporter commented 9 years ago
I've decided not to add more exceptions. Checking arguments and throwing 
exceptions
is expensive in JavaScript. I will instead create a plugin that does more 
ruthless
validation.

Original comment by dean.edw...@gmail.com on 14 Sep 2007 at 7:23