[haiku-development] Re: Locale kit error handling problems

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 26 Nov 2009 22:05:59 +0100

PulkoMandy <pulkomandy@xxxxxxxxx> wrote:
> Le Thu, 26 Nov 2009 20:50:36 +0100, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
> >
> a écrit:
> > I noticed two problems in the locale kit code that you introduced:
> > * you use assert() for runtime error handling - you must only use
> > assert
> > to detect internal inconsistencies, not runtime errors!
> AFAIR, these were introduced for things that never happens, and helped
> me
> debug them.

But that's not what you are using assert()s for. I would guess "err"
could mean that data files are corrupted, or the function ran out of
memory - both cases deserve error checking, not assert()s.

> > * you directly return ICU errors.
> Yes, this is my fault, I was not sure how to translate them to
> Haikuish
> error codes.

When in doubt, just return B_ERROR; apart from that, one could add
additional error codes as outlined by François.

> > * the ssize_t is thought to return a length, or a status (not just
> > a
> > status as assumed in BCountry::FormatMonetary()).
> ok, will check that next time.
>
> Note that besides the catalog system and a little work on date
> formatting
> that I don't consider finished, the API for locale is still mostly
> stubs
> and work-in-progress things. Unfortunately I have much less time now
> to
> work on it, so it's somewhat stalled.

Understood; since it's not yet sure that the locale kit will be active
in R1, it doesn't have high priority for me either at the moment. But
this might change later on :-)

Bye,
   Axel.


Other related posts: