Wt::Dbo::Exception
Added by Saif Rehman 4 months ago
Hello,
I came across a problem with dealing with Wt::Dbo::Exception. It includes exceptions thrown from both, backend errors and Wt::Dbo's API misuse. What I wanted to do was to fetch a Many side Dbo while using the try...catch block to catch a Wt::Dbo::Exception if there were no records in that Many side Dbo. But the problem is, wouldn't it be caught for both reasons, the end of Dbo::collection and/or backend API problem.
I want to run different procedure for the different reasons for the exception to be caught. Is there a workaround for this or should there be 2 different exception classes for Wt::Dbo?
Thank you.
Replies
RE: Wt::Dbo::Exception - Added by Koen Deforche 4 months ago
Hey Saif,
I think relying on the Wt::Dbo::Exception for detecting out-of-bounds access on a collection is bad form. It is really considered API misuse, which in our book, a programming error.
So you should really see if iterator != collection.end() before accessing it.
Or am I overlooking something here ?
Regards,
koen