Subject | Handling error messages in a single point of the application |
---|---|
Author | Carlos H. Cantu |
Post date | 2007-03-28T00:40:16Z |
Hello!
I plan to use the OnError event from IB_Connection to build a special
parsing routine to handle common database errors, like violation of
primary keys, foreign key violations, etc and build up messages easier
to understand to the common user.
For example, in a primary key violation, I would like to build
something like:
"You tried to save a record in table <table name here> with values in
the fields <list primary key fields here> that already exists. You
can't have two records with the same values in those fields."
This is not easy, specially because the Sender object in that event
will be the Connection component, and not the dataset component that
generated the error.
I will be glad if someone here already have done something like this
and would like to share the code with me.
[]s
Carlos
http://www.firebirdnews.org
FireBase - http://www.FireBase.com.br
I plan to use the OnError event from IB_Connection to build a special
parsing routine to handle common database errors, like violation of
primary keys, foreign key violations, etc and build up messages easier
to understand to the common user.
For example, in a primary key violation, I would like to build
something like:
"You tried to save a record in table <table name here> with values in
the fields <list primary key fields here> that already exists. You
can't have two records with the same values in those fields."
This is not easy, specially because the Sender object in that event
will be the Connection component, and not the dataset component that
generated the error.
I will be glad if someone here already have done something like this
and would like to share the code with me.
[]s
Carlos
http://www.firebirdnews.org
FireBase - http://www.FireBase.com.br