[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: UU: DB: Exception differentiation
- To: uu@total-knowledge.com
- Subject: Re: UU: DB: Exception differentiation
- From: "Alexey Parshin" <alexeyp@gmail.com>
- Date: Sat, 27 Dec 2008 10:06:56 +1100
- Delivered-to: mailing list uu@total-knowledge.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=uub8O+CB6bB6wocm9rZbZgNm6jP8Gt6UN3FgF45udrk=; b=H1RwAG0plXbSxAZXoxlITAHhX7my34Zg3Z4xgt9w/+VW+qB6L+WdaVriU3gpuTJTt4 oFOJaYR2oORQX3DvSrbO75eG4CGob9YFRQNZE3hb28zBEnfjisW2jRpkzX3GSe5FfwVy YqYAjTTzpJ26sRPknFIzyXUwd3mJSWAyEpFPU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=NOD8SWJv3x6IChk/C4CHbpiDC8CGsryPKPUBRffJw9qbA2pHtqXzSLGFF63/DgzD/C wjN6IG/HV63ZdAQMzVPm0Ctt52TFKYsBFNgDaqsF0D1rgiBGAwl0uOeL7FP/Q2YKO87b vjO2T2Ajp6e97LIwynqJ/Y2bJLCLotkxmx0jk=
- In-reply-to: <4955565B.70406@total-knowledge.com>
- Mailing-list: contact uu-help@total-knowledge.com; run by ezmlm
- References: <4955565B.70406@total-knowledge.com>
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
possible?
Ilya.
--
Alexey Parshin,
http://www.sptk.net