3 messages in com.mysql.lists.plusplusRE: Exceptions in MySQL++
FromSent OnAttachments
Adam H. Peterson21 May 2002 08:44 
Kristean Heisler21 May 2002 11:52 
Adam H. Peterson22 May 2002 07:40 
Subject:RE: Exceptions in MySQL++
From:Adam H. Peterson (ah@email.byu.edu)
Date:05/22/2002 07:40:49 AM
List:com.mysql.lists.plusplus

Thank you for your reply, but I don't understand. There's no reason a global class can't inherit from a class in a different namespace.

class BadQuery : public std::exception { /* ... */ };

-----Original Message----- From: Kristean Heisler [mailto:Kris@gmx.net] Sent: 2002 May 21 Tuesday 12:53 To: Adam H. Peterson; plus@lists.mysql.com Subject: Re: Exceptions in MySQL++

Hi Adam,

MySQL++ isn't a std namespace extension - MySQL++ uses global namespace, so you can't use std::exeption. You have to use catch(BadQuery& err)

I'm just learning MySQL and MySQL++, so perhaps this is a stupid question, but I was wondering why BadQuery and the other MySQL exceptions in MySQL++ don't derive from std::exception. It would make it easier to catch exceptions, since my programs already do something like:

try { /* . */ } catch (std::exception const &err) { std::cerr << err.what() << std::endl; return 1; }

Thanks, Adam Peterson