Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » question about overriding SqlError
question about overriding SqlError [message #38970] Fri, 01 February 2013 14:59 Go to next message
Peter is currently offline  Peter
Messages: 16
Registered: October 2012
Promising Member
Hi.

I wanted to override SkylarkApp::SqlError method so that I can handle SQL errors the way I like. My first attempt was something like this:

void ChairSupervisor::SqlError(Http& http, const SqlExc& e)
{
   http << "<html><body>SQL error</body</html>";
}


Then I executed exception-throwing SQL query to check if my method works as intended. As a result I expected to see a blank page with "SQL error" text on it. Instead, the whole DB error message appeared on the screen with my message appended to it.
This is not what I want. Is there any way to get rid of the original DB error message and just display my own error message instead?

In Http::Dispatch the following code is responsible for current behaviour:

response << "Internal server error<br>"
         << "SQL ERROR: " << e;

app.SqlError(*this, e);


So, basically, SQL error message from e (SQL exception object) is always displayed and my own message is later appended to it. Can I do anything to change this if I don't want to modify library code myself?
Re: question about overriding SqlError [message #39039 is a reply to message #38970] Sat, 09 February 2013 09:43 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Resolved by moving default messages to default virtual methods...

Mirek
Previous Topic: Something wrong with post_identity()?
Next Topic: Skylark and Date/Time format
Goto Forum:
  


Current Time: Thu Mar 28 10:19:04 CET 2024

Total time taken to generate the page: 0.01069 seconds