Home Projects Jobs Clientele Contact


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UU: DB: Exception differentiation

Well, first, PG always throws the same exception. It doesn't support anything but messages.

Second, we can standardise several exception classes, like "Invalid data value" or "Record not found", but the only way is to put something in the message within stored proc, like:

   RAISE EXCEPTION '{INVALID_DATA_VALUE} Field language can not be NULL or 0';

In that case you still have to process the message but you have less guessing, and you can distinguish PG internal exceptions from our exceptions.

2008/12/27 Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com>
Currently PostgreSQL doesn't support differentiating
between user-initiated exceptions, except by message.

However, it isn't the best way to differentiate exceptions
in C++. I'd like to come up with a mechanism for differentiating
UU exceptions in some uniform way.

Ideally, we'd have a common source of mapping code to
meaning, shared between stored procedures and C++
(or a common source, which would be preprocessed
to generate C++ header and postgresql script).

This way we could have easily maintainable error messages,
uniform status codes, and easy way to do i18n.

Any ideas on how to implement it in the best way


Alexey Parshin,

Authoright © Total Knowledge: 2001-2008