/usr/include/Wt/Dbo/Exception is in libwtdbo-dev 3.3.3+dfsg-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WT_DBO_EXCEPTION_H_
#define WT_DBO_EXCEPTION_H_
#include <string>
#include <stdexcept>
#include <Wt/Dbo/WDboDllDefs.h>
namespace Wt {
namespace Dbo {
/*! \class Exception Wt/Dbo/Exception Wt/Dbo/Exception
* \brief %Exception base class for %Wt::%Dbo.
*
* \ingroup dbo
*/
class WTDBO_API Exception : public std::runtime_error
{
public:
/*! \brief Constructor.
*/
Exception(const std::string& error, const std::string& code = std::string());
virtual ~Exception() throw();
/*! \brief A (backend-specific) error code.
*
* For native SQL errors, a native backend code may be available
* (see the backend documentation for details). This is typically
* the (semi-standardized) SQLSTATE code value.
*
* When not available, an empty string is returned.
*/
std::string code() const { return code_; }
private:
std::string code_;
};
/*! \class StaleObjectException Wt/Dbo/Exception Wt/Dbo/Exception
* \brief %Exception thrown when %Wt::%Dbo detects a concurrent modification
*
* %Wt::%Dbo uses optimistic locking for detecting and preventing
* concurrent modification of database objects. When trying to save an
* object that has been modified concurrently by another session, since
* it was read from the database, this exception is thrown.
*
* This exception is thrown during flushing from Session::flush() or
* ptr::flush(). Since flushing will also be done automatically when
* needed (e.g. before running a query or before committing a
* transaction), you should be prepared to catch this exception from most
* library API calls.
*
* \note We should perhaps also have a ptr::isStale() method to find out
* what database object is stale ?
*
* \ingroup dbo
*/
class WTDBO_API StaleObjectException : public Exception
{
public:
/*! \brief Constructor.
*/
StaleObjectException(const std::string& id, int version);
};
/*! \class ObjectNotFoundException Wt/Dbo/Exception Wt/Dbo/Exception
* \brief %Exception thrown when trying to load a non-existing object.
*
* This %Exception is thrown by Session::load() when trying to load an object
* that does not exist.
*
* \ingroup dbo
*/
class WTDBO_API ObjectNotFoundException : public Exception
{
public:
/*! \brief Constructor.
*/
ObjectNotFoundException(const std::string& id);
};
/*! \class NoUniqueResultException Wt/Dbo/Exception Wt/Dbo/Exception
* \brief %Exception thrown when a query unexpectedly finds a non-unique result.
*
* This %Exception is thrown by Query::resultValue() when the query has
* more than one result.
*
* \ingroup dbo
*/
class WTDBO_API NoUniqueResultException : public Exception
{
public:
/*! \brief Constructor.
*/
NoUniqueResultException();
};
}
}
#endif // WT_DBO_EXCEPTION_H_
|