On 29 March 2013 09:59, Alex Ott <[email protected]> wrote:
>
> Regarding error handling - it would be nice to have some common set of
> error codes (enum?) propagated together with exception

I think it's a good idea to to try to unify errors.

> - in my app I
> don't know which database will be supported until runtime (I link only
> core, and modules are loaded dynamically), so I can't link specific DB
> modules to get DB-specific exceptions.

I have overlooked this very good point. Likely, because I don't use
dynamically loaded backends myself.

I was hoping the paper linked by Sergei [1] would suggest a neat
solution, but it only states what we already know:
"it is not trivial to implement, as there exists a database state this is
coupled with but separate from the application state".

[1] http://isocpp.org/files/papers/n3612.pdf

I haven't given lots of thoughts on how to improve exceptions in SOCI.
Briefly, I see several approaches:
1) never carry database session state in exception object, but compose
complete exception before throwing
2) carry database state, i.e. SOCI backend

I also wonder if we could learn a lesson from C++11 features like
std::error_category and std::error_code to model SOCI errors.
If we don't switch to C++11 for SOCI 4, we could use Boost.System.

Thoughts?

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to