Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
feeda5c6
Commit
feeda5c6
authored
Aug 25, 2016
by
Steven Murray
Committed by
Victor Kotlyar
Aug 29, 2016
Browse files
Simply replaced CASTOR's Exception class with that of CTA
parent
879c4268
Changes
170
Hide whitespace changes
Inline
Side-by-side
tapeserver/castor/BaseObject.cpp
View file @
feeda5c6
...
...
@@ -26,9 +26,9 @@
#include
"castor/Constants.hpp"
#include
"castor/Services.hpp"
#include
"castor/BaseObject.hpp"
#include
"castor/exception/Exception.hpp"
#include
"castor/server/Mutex.hpp"
#include
"castor/server/MutexLocker.hpp"
#include
"common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// static values initialization
...
...
@@ -82,7 +82,7 @@ castor::Services* castor::BaseObject::services()
const
int
rc
=
pthread_setspecific
(
s_servicesKey
,
services
);
if
(
0
!=
rc
)
{
delete
services
;
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Error caught in call to pthread_setspecific"
;
throw
e
;
}
...
...
@@ -102,7 +102,7 @@ void castor::BaseObject::resetServices()
delete
services
();
const
int
rc
=
pthread_setspecific
(
s_servicesKey
,
NULL
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Failed to reset the thread's servicesKey to NULL after delete"
;
throw
e
;
}
...
...
tapeserver/castor/BaseObject.hpp
View file @
feeda5c6
...
...
@@ -25,7 +25,7 @@
#pragma once
// Include Files
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
#include
<pthread.h>
namespace
castor
{
...
...
@@ -89,7 +89,7 @@ namespace castor {
pthreadKey
()
{
int
rc
=
pthread_key_create
(
&
m_key
,
NULL
);
if
(
rc
!=
0
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Error caught in call to pthread_key_create (from castor::BaseObject::pthreadKey::pthreadKey"
;
throw
e
;
}
...
...
tapeserver/castor/ICnvSvc.hpp
View file @
feeda5c6
...
...
@@ -27,7 +27,7 @@
// Include Files
#include
"castor/IService.hpp"
#include
"castor/Constants.hpp"
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
#include
<vector>
namespace
castor
{
...
...
tapeserver/castor/Services.cpp
View file @
feeda5c6
...
...
@@ -31,7 +31,7 @@
#include
"IAddress.hpp"
#include
"IObject.hpp"
#include
"ICnvSvc.hpp"
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
//-----------------------------------------------------------------------------
// Constructor
...
...
@@ -65,7 +65,7 @@ castor::IService* castor::Services::service(const std::string name,
const
ISvcFactory
*
fac
=
castor
::
Factories
::
instance
()
->
factory
(
id
);
// if no factory is available, complain
if
(
0
==
fac
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"No factory found for object type "
<<
id
;
throw
e
;
}
...
...
@@ -73,7 +73,7 @@ castor::IService* castor::Services::service(const std::string name,
IService
*
svc
=
fac
->
instantiate
(
name
);
// if the service was not instantiated, complain
if
(
0
==
svc
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"No service found for service "
<<
name
;
throw
e
;
}
else
{
...
...
@@ -160,7 +160,7 @@ castor::Services::cnvSvcFromAddress(castor::IAddress* address)
{
// check address
if
(
0
==
address
)
{
ca
stor
::
exception
::
Exception
ex
;
c
t
a
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"No appropriate converter for a null address !"
;
throw
ex
;
}
...
...
@@ -168,7 +168,7 @@ castor::Services::cnvSvcFromAddress(castor::IAddress* address)
castor
::
ICnvSvc
*
cnvSvc
=
cnvService
(
address
->
cnvSvcName
(),
address
->
cnvSvcType
());
if
(
0
==
cnvSvc
)
{
ca
stor
::
exception
::
Exception
ex
;
c
t
a
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"No conversion service with name "
<<
address
->
cnvSvcName
()
<<
" and type "
<<
address
->
cnvSvcType
();
...
...
tapeserver/castor/Services.hpp
View file @
feeda5c6
...
...
@@ -27,7 +27,7 @@
//Include Files
#include
<vector>
#include
<map>
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
namespace
castor
{
...
...
tapeserver/castor/System.cpp
View file @
feeda5c6
...
...
@@ -60,7 +60,7 @@ std::string castor::System::getHostName()
if
(
EINVAL
!=
errno
&&
ENAMETOOLONG
!=
errno
)
{
free
(
hostname
);
ca
stor
::
exception
::
Exception
e
(
errno
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"gethostname error"
;
throw
e
;
}
...
...
@@ -70,7 +70,7 @@ std::string castor::System::getHostName()
char
*
hostnameLonger
=
(
char
*
)
realloc
(
hostname
,
len
);
if
(
0
==
hostnameLonger
)
{
free
(
hostname
);
ca
stor
::
exception
::
Exception
e
(
ENOMEM
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Could not allocate memory for hostname"
;
throw
e
;
...
...
@@ -83,7 +83,7 @@ std::string castor::System::getHostName()
if
(
EINVAL
!=
errno
&&
ENAMETOOLONG
!=
errno
)
{
free
(
hostname
);
ca
stor
::
exception
::
Exception
e
(
errno
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Could not get hostname"
<<
strerror
(
errno
);
throw
e
;
...
...
@@ -105,12 +105,12 @@ int castor::System::porttoi(char* str)
errno
=
0
;
int
iport
=
strtoul
(
str
,
&
dp
,
0
);
if
(
*
dp
!=
0
)
{
ca
stor
::
exception
::
Exception
e
(
errno
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Bad port value."
<<
std
::
endl
;
throw
e
;
}
if
((
iport
>
65535
)
||
(
iport
<
0
))
{
ca
stor
::
exception
::
Exception
e
(
errno
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Invalid port value : "
<<
iport
<<
". Must be < 65535 and > 0."
<<
std
::
endl
;
...
...
@@ -138,27 +138,27 @@ void castor::System::switchToCastorSuperuser()
// Get information on generic stage account from password file
if
((
stage_passwd
=
getpwnam
(
STAGERSUPERUSER
))
==
NULL
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Castor super user "
<<
STAGERSUPERUSER
<<
" not found in password file"
;
throw
e
;
}
// verify existence of its primary group id
if
(
getgrgid
(
stage_passwd
->
pw_gid
)
==
NULL
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Castor super user group does not exist"
;
throw
e
;
}
// Get information on generic stage account from group file
if
((
stage_group
=
getgrnam
(
STAGERSUPERGROUP
))
==
NULL
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Castor super user group "
<<
STAGERSUPERGROUP
<<
" not found in group file"
;
throw
e
;
}
// Verify consistency
if
(
stage_group
->
gr_gid
!=
stage_passwd
->
pw_gid
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Inconsistent password file. The group of the "
<<
"castor superuser "
<<
STAGERSUPERUSER
<<
" should be "
<<
stage_group
->
gr_gid
...
...
@@ -168,25 +168,25 @@ void castor::System::switchToCastorSuperuser()
}
// Undo group privilege
if
(
setregid
(
egid
,
rgid
)
<
0
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Unable to undo group privilege"
;
throw
e
;
}
// Undo user privilege
if
(
setreuid
(
euid
,
ruid
)
<
0
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Unable to undo user privilege"
;
throw
e
;
}
// set the effective privileges to superuser
if
(
setegid
(
stage_passwd
->
pw_gid
)
<
0
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Unable to set group privileges of Castor Superuser. "
<<
"You may want to check that the suid bit is set properly"
;
throw
e
;
}
if
(
seteuid
(
stage_passwd
->
pw_uid
)
<
0
)
{
ca
stor
::
exception
::
Exception
e
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Unable to set privileges of Castor Superuser."
;
throw
e
;
}
...
...
tapeserver/castor/System.hpp
View file @
feeda5c6
...
...
@@ -26,7 +26,7 @@
// Include Files
#include
<string>
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
namespace
castor
{
...
...
tapeserver/castor/common/CastorConfiguration.cpp
View file @
feeda5c6
...
...
@@ -44,7 +44,7 @@ castor::common::CastorConfiguration::getConfig(std::string fileName)
// lock
int
rc
=
pthread_mutex_lock
(
&
s_globalConfigLock
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Failed to get CASTOR configuration:"
" Failed to take a lock on s_globalConfigLock"
;
throw
e
;
...
...
@@ -77,7 +77,7 @@ castor::common::CastorConfiguration::CastorConfiguration(std::string fileName)
// create internal r/w lock
int
rc
=
pthread_rwlock_init
(
&
m_lock
,
NULL
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"CastorConfiguration constructor Failed"
": Failed to create internal r/w lock"
;
throw
e
;
...
...
@@ -94,7 +94,7 @@ castor::common::CastorConfiguration::CastorConfiguration(
// create a new internal r/w lock
int
rc
=
pthread_rwlock_init
(
&
m_lock
,
NULL
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"CastorConfiguration copy constructor failed"
": Failed to create a new internal r/w lock"
;
throw
e
;
...
...
@@ -122,7 +122,7 @@ castor::common::CastorConfiguration &
// create a new internal r/w lock
int
rc
=
pthread_rwlock_init
(
&
m_lock
,
NULL
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Assignment operator of CastorConfiguration object failed"
": Failed to create a new internal r/w lock"
;
throw
e
;
...
...
@@ -143,7 +143,7 @@ const std::string& castor::common::CastorConfiguration::getConfEntString(
// get read lock
int
rc
=
pthread_rwlock_rdlock
(
&
m_lock
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Failed to get configuration entry "
<<
category
<<
":"
<<
key
<<
": Failed to get read lock"
;
throw
e
;
...
...
@@ -178,7 +178,7 @@ const std::string& castor::common::CastorConfiguration::getConfEntString(
}
// Unlock and return default
pthread_rwlock_unlock
(
&
m_lock
);
}
catch
(
ca
stor
::
exception
::
Exception
ex
)
{
}
catch
(
c
t
a
::
exception
::
Exception
ex
)
{
// exception caught : Unlock and return default
pthread_rwlock_unlock
(
&
m_lock
);
// log the exception
...
...
@@ -210,7 +210,7 @@ const std::string& castor::common::CastorConfiguration::getConfEntString(
// get read lock
int
rc
=
pthread_rwlock_rdlock
(
&
m_lock
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Failed to get configuration entry "
<<
category
<<
":"
<<
key
<<
": Failed to get read lock"
;
throw
e
;
...
...
@@ -261,7 +261,7 @@ bool castor::common::CastorConfiguration::isStale()
// get read lock
int
rc
=
pthread_rwlock_rdlock
(
&
m_lock
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Failed to determine if CASTOR configuration is stale"
": Failed to get read lock"
;
throw
e
;
...
...
@@ -288,7 +288,7 @@ void castor::common::CastorConfiguration::tryToRenewConfig()
// we should probably renew. First take the write lock.
int
rc
=
pthread_rwlock_wrlock
(
&
m_lock
);
if
(
0
!=
rc
)
{
ca
stor
::
exception
::
Exception
e
(
rc
)
;
c
t
a
::
exception
::
Exception
e
;
e
.
getMessage
()
<<
"Failed to renew configuration cache"
": Failed to take write lock"
;
throw
e
;
...
...
@@ -343,7 +343,7 @@ void castor::common::CastorConfiguration::renewConfigNolock()
// failure
std
::
ifstream
file
(
m_fileName
.
c_str
());
if
(
file
.
fail
())
{
ca
stor
::
exception
::
Exception
ex
(
EIO
)
;
c
t
a
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
__FUNCTION__
<<
" failed"
": Failed to open file"
": m_fileName="
<<
m_fileName
;
...
...
tapeserver/castor/common/CastorConfiguration.hpp
View file @
feeda5c6
...
...
@@ -23,10 +23,10 @@
#pragma once
#include
"castor/exception/Exception.hpp"
#include
"castor/exception/NoEntry.hpp"
#include
"castor/log/Logger.hpp"
#include
"castor/utils/utils.hpp"
#include
"common/exception/Exception.hpp"
#include
<string>
#include
<map>
...
...
@@ -141,7 +141,7 @@ namespace castor {
std
::
string
strValue
;
try
{
strValue
=
getConfEntString
(
category
,
key
);
}
catch
(
ca
stor
::
exception
::
Exception
&
ex
)
{
}
catch
(
c
t
a
::
exception
::
Exception
&
ex
)
{
if
(
NULL
!=
log
)
{
std
::
list
<
log
::
Param
>
params
=
{
log
::
Param
(
"category"
,
category
),
...
...
tapeserver/castor/exception/AcceptConnectionInterrupted.cpp
View file @
feeda5c6
...
...
@@ -29,7 +29,7 @@
// -----------------------------------------------------------------------------
castor
::
exception
::
AcceptConnectionInterrupted
::
AcceptConnectionInterrupted
(
const
time_t
remainingTime
)
throw
()
:
ca
stor
::
exception
::
Exception
(
666
),
c
t
a
::
exception
::
Exception
(),
m_remainingTime
(
remainingTime
)
{
// Do nothing
...
...
tapeserver/castor/exception/AcceptConnectionInterrupted.hpp
View file @
feeda5c6
...
...
@@ -23,7 +23,7 @@
#pragma once
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
#include
<sys/types.h>
...
...
@@ -33,7 +33,7 @@ namespace exception {
/**
* castor::io::acceptConnection() was interrupted.
*/
class
AcceptConnectionInterrupted
:
public
ca
stor
::
exception
::
Exception
{
class
AcceptConnectionInterrupted
:
public
c
t
a
::
exception
::
Exception
{
public:
...
...
tapeserver/castor/exception/BadAlloc.cpp
View file @
feeda5c6
...
...
@@ -28,5 +28,5 @@
// Constructor
// -----------------------------------------------------------------------------
castor
::
exception
::
BadAlloc
::
BadAlloc
()
:
ca
stor
::
exception
::
Exception
(
666
)
{
c
t
a
::
exception
::
Exception
()
{
}
tapeserver/castor/exception/BadAlloc.hpp
View file @
feeda5c6
...
...
@@ -23,14 +23,14 @@
#pragma once
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
namespace
castor
{
namespace
exception
{
/**
* BadAlloc.
*/
class
BadAlloc
:
public
ca
stor
::
exception
::
Exception
{
class
BadAlloc
:
public
c
t
a
::
exception
::
Exception
{
public:
...
...
tapeserver/castor/exception/CommandLineNotParsed.cpp
View file @
feeda5c6
...
...
@@ -28,5 +28,5 @@
// Constructor
// -----------------------------------------------------------------------------
castor
::
exception
::
CommandLineNotParsed
::
CommandLineNotParsed
()
:
ca
stor
::
exception
::
Exception
(
666
)
{
c
t
a
::
exception
::
Exception
()
{
}
tapeserver/castor/exception/CommandLineNotParsed.hpp
View file @
feeda5c6
...
...
@@ -23,14 +23,14 @@
#pragma once
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
namespace
castor
{
namespace
exception
{
/**
* CommandLineNotParsed.
*/
class
CommandLineNotParsed
:
public
ca
stor
::
exception
::
Exception
{
class
CommandLineNotParsed
:
public
c
t
a
::
exception
::
Exception
{
public:
...
...
tapeserver/castor/exception/DismountFailed.hpp
View file @
feeda5c6
...
...
@@ -23,14 +23,14 @@
#pragma once
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
namespace
castor
{
namespace
exception
{
/**
* Failed to dismount volume.
*/
class
DismountFailed
:
public
ca
stor
::
exception
::
Exception
{
class
DismountFailed
:
public
c
t
a
::
exception
::
Exception
{
public:
...
...
tapeserver/castor/exception/EndOfFile.hpp
View file @
feeda5c6
...
...
@@ -23,16 +23,16 @@
#pragma once
#include
"c
astor
/exception/Exception.hpp"
#include
"c
ommon
/exception/Exception.hpp"
#include
<string>
namespace
castor
{
namespace
exception
{
class
EndOfFile
:
public
ca
stor
::
exception
::
Exception
{
class
EndOfFile
:
public
c
t
a
::
exception
::
Exception
{
public:
EndOfFile
(
const
std
::
string
&
w
)
:
ca
stor
::
exception
::
Exception
(
w
)
{}
EndOfFile
(
const
std
::
string
&
w
)
:
c
t
a
::
exception
::
Exception
(
w
)
{}
virtual
~
EndOfFile
()
throw
()
{}
};
}}
\ No newline at end of file
}}
tapeserver/castor/exception/Errnum.hpp
View file @
feeda5c6
...
...
@@ -24,11 +24,11 @@
#pragma once
#include
"Exception.hpp"
#include
"
common/exception/
Exception.hpp"
namespace
castor
{
namespace
exception
{
class
Errnum
:
public
ca
stor
::
exception
::
Exception
{
class
Errnum
:
public
c
t
a
::
exception
::
Exception
{
public:
Errnum
(
std
::
string
what
=
""
);
Errnum
(
int
err
,
std
::
string
what
=
""
);
...
...
tapeserver/castor/exception/Exception.cpp
deleted
100644 → 0
View file @
879c4268
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#define _XOPEN_SOURCE 600
#include
"castor/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor
::
exception
::
Exception
::
Exception
(
int
se
,
std
::
string
context
,
bool
embedBacktrace
)
:
m_message
(
context
),
m_serrno
(
se
),
m_backtrace
(
!
embedBacktrace
)
{}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor
::
exception
::
Exception
::
Exception
(
std
::
string
context
,
bool
embedBacktrace
)
:
m_message
(
context
),
m_serrno
(
666
),
m_backtrace
(
!
embedBacktrace
)
{}
//------------------------------------------------------------------------------
// copy constructor
//------------------------------------------------------------------------------
castor
::
exception
::
Exception
::
Exception
(
const
castor
::
exception
::
Exception
&
rhs
)
:
std
::
exception
()
{
m_serrno
=
rhs
.
m_serrno
;
m_message
<<
rhs
.
m_message
.
str
();
m_backtrace
=
rhs
.
m_backtrace
;
}
//------------------------------------------------------------------------------
// assignment operator
//------------------------------------------------------------------------------
castor
::
exception
::
Exception
&
castor
::
exception
::
Exception
::
operator
=
(
const
castor
::
exception
::
Exception
&
rhs
)
{
m_serrno
=
rhs
.
m_serrno
;
m_message
<<
rhs
.
m_message
.
str
();
return
*
this
;
}
//------------------------------------------------------------------------------
// what operator
//------------------------------------------------------------------------------
const
char
*
castor
::
exception
::
Exception
::
what
()
const
throw
()
{
m_what
=
getMessageValue
();
m_what
+=
"
\n
"
;
m_what
+=
(
std
::
string
)
m_backtrace
;
return
m_what
.
c_str
();
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor
::
exception
::
Exception
::~
Exception
()
throw
()
{}
//------------------------------------------------------------------------------
// setWhat
//------------------------------------------------------------------------------
void
castor
::
exception
::
Exception
::
setWhat
(
const
std
::
string
&
what
)
{
getMessage
()
<<
what
;
}
tapeserver/castor/exception/Exception.hpp
deleted
100644 → 0
View file @
879c4268
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include
"tapeserver/castor/exception/Backtrace.hpp"
#include
<exception>
#include
<sstream>
namespace
castor
{
namespace
exception
{
/**
* class Exception
* A simple exception used for error handling in castor
*/
class
Exception
:
public
std
::
exception
{
public:
/**
* Empty Constructor
* @param serrno the serrno code of the corresponding C error
* @param context optional context string added to the message
* at initialisation time.
* @param embedBacktrace whether to embed a backtrace of where the
* exception was throw in the message
*/
Exception
(
int
se
,
std
::
string
context
=
""
,
bool
embedBacktrace
=
true
);
/**
* Empty Constructor with implicit serrno = SEINERNAL;
* @param context optional context string added to the message
* at initialisation time.
* @param embedBacktrace whether to embed a backtrace of where the