ivd_BaseException Class Reference
[Common, basic classes, functions and types]

#include <ivderror.h>

Inheritance diagram for ivd_BaseException:

Inheritance graph
[legend]

List of all members.


Detailed Description

The base exception class.

ivd_Exception and ivd_InternalError are derived from this class.

Definition at line 37 of file ivderror.h.


Public Member Functions

virtual ~ivd_BaseException () throw ()
int GetError () const
 Returns ivd_Exception::m_error.
string GetText () const
 Returns ivd_Exception::m_formatted, which contains full description.
string GetDescription () const
 Returns ivd_Exception::m_context + m_detail.
const string & GetContext () const
 Returns ivd_Exception::m_context.
const string & GetDetailed () const
 Returns ivd_Exception::m_detail.
string GetFriendly () const
 User friendly output of the exception.
virtual const char * what () const throw ()
 Overloded standard exception output prints ivd_Exception::m_formatted member.

Protected Member Functions

 ivd_BaseException (const int a_error, const string &a_context, bool a_logError) throw ()
 Constructor for ivd_Exception.
 ivd_BaseException (const int a_error, const string &a_context, const string &a_detailed, bool a_logError) throw ()
virtual string GetErrorText () const
 Member function to supply ivd_Exception::m_errorText.
void FormatText (const string &a_className)
 Member function to format ivd_Exception::m_formatted, used in operator<< and what().

Protected Attributes

const int m_error
 Error code.
const string m_context
 Optional description of the context, where an error has occured.
const string m_detailed
 more detailed description
string m_errorText
 Error text, most often acquired from ivd_Exception::m_error.
string m_formatted
 Formatted string representation of an error.
bool m_log

Private Attributes

 log_CLASSID_m

Friends

IVD_CMN_DECL_d ostream & operator<< (ostream &a_os, const ivd_BaseException &a_ivdex)
 Operator prints ivd_Exception::m_formatted.
IVD_CMN_DECL_d ostream & operator<< (ostream &a_os, ivd_BaseException &a_ivdex)

Constructor & Destructor Documentation

ivd_BaseException::~ivd_BaseException (  )  throw () [virtual]

Definition at line 138 of file ivd_exception.cpp.

00138                                               {
00139 }

ivd_BaseException::ivd_BaseException ( const int  a_error,
const string &  a_context,
bool  a_logError 
) throw () [protected]

Constructor for ivd_Exception.

Parameters:
a_error Exception error code. Has a special meaning in derived classes.
a_context Context, when an error has happened. An addition to error code text.
a_logError Log an error at throw.

Definition at line 117 of file ivd_exception.cpp.

00118     : m_error(a_error),
00119       m_context(a_context),
00120       m_log(a_logError)  {
00121 
00122     // Top level IVD Exception should never be thrown.
00123 }

ivd_BaseException::ivd_BaseException ( const int  a_error,
const string &  a_context,
const string &  a_detailed,
bool  a_logError 
) throw () [protected]

Definition at line 125 of file ivd_exception.cpp.

00130         :
00131         m_error(a_error),
00132         m_context(a_context),
00133         m_detailed(a_detailed),
00134         m_log(a_logError)  {
00135     // Top level IVD Exception should never be thrown.
00136 }


Member Function Documentation

int ivd_BaseException::GetError (  )  const

Returns ivd_Exception::m_error.

Definition at line 141 of file ivd_exception.cpp.

References m_error.

Referenced by hsm_ActiveFH::ActiveToList(), val_List< val_FileNamePattern, string >::Add(), val_SlotList::Add(), rm_Operator::Add(), i_ManagementInterface_i::AddDrive(), fs_api::AddGenericEvent(), i_ManagementInterface_i::AddLibrary(), i_ManagementInterface_i::AddMediumToPool(), i_ManagementInterface_i::AddPartition(), i_ManagementInterface_i::AddPool(), val_List< val_FileNamePattern, string >::AddRange(), val_SlotList::AddRange(), rm_Operator::AllocateAdmin(), rm_Operator::AllocateRecall(), bea_TapeMedium::ChangeVolume(), rm_Operator::CheckAndAdd(), i_HSM_i::CheckFSCvsIVDFS(), fsc_DataLMgr::CheckLastGen(), Connect(), cfg_Base::Convert(), bea_FRI::CopyFromDiskToMedium(), hsm_IVDFSRecoverer::CreateFile(), api_Partition::CreateMajorCol(), bea_FRI::DeleteFRIOnDisk(), i_ManagementInterface_i::DisableLibrary(), fio_JourFile::Dump(), la_SCSILibrary::EjectMedium(), i_ManagementInterface_i::EnableLibrary(), api_Partition::EnumMajorCollocationId(), api_Partition::EnumMinorCollocationId(), bea_TapeVolume::Erase(), i_ReorgJob_i::Execute(), i_RedundantCopyJob_i::Execute(), rm_Operator::GetBestCopy(), mif_CfgRep::GetCfg(), api_Partition::GetFileLocations(), api_Partition::GetFileStatus(), rm_Operator::GetHost(), i_Job_i::GetJobParams(), i_ManagementInterface_i::GetPartitionStatus(), bea_TapeVolume::GetPosition(), la_SCSILibrary::HandleDriveError(), i_BackEndAgent_i::HandleError(), i_ManagementInterface_i::i_ManagementInterface_i(), i_MediumDupl_i::i_MediumDupl_i(), i_PartitionManager_i::i_PartitionManager_i(), i_ReorgJob_i::i_ReorgJob_i(), bea_Volume::Init(), i_ReorgJob_i::InitializeVolumes(), i_FSC_i::InsertSplitFromFRIBlock(), rm_Operator::InventoryUpdate(), IsFileOffline(), Collocation::IsReplicated(), rm_Operator::IsSomeVolumeUsed(), ivd_AccessFsAttr(), ivd_FS_File::ivd_FS_File(), api_Partition::JobStatus(), i_ManagementInterface_i::ListDrives(), ListJobsinPM(), i_ManagementInterface_i::ListSingleMedium(), i_Job_i::LoadUnload(), main(), bea_MigrationThread::Migrate(), i_HSM_i::MigrateByAPI(), api_Partition::MigrateFile(), bea_Volume::MustDumpFRI(), bea_TapeDrive::Open(), fsc_SplitStream_t::Pack(), i_HSM_i::PackFile(), PackFile(), ap_Argument::Parse(), ParseTapeMedium(), ParseTapeMediumSysVolume(), ParseTapeMediumVolume(), ParseTapeMediumVolumeData(), ParseTapeMediumVolumeFRI(), ParseTapeMediumVolumeHeader(), i_ManagementInterface_i::PartitionStatus(), bea_FRI::PositionToStartOfFRI(), bea_MigrationThread::PrepareVolume(), CreateTree::PreprocessDir(), dbo_InitAllResource::Process(), i_RecallJob_i::Process(), i_EfficientRecallJob_i::Process(), hsm_IVDFSRecoverer::ProcRecFileEnd(), hsm_IVDFSRecoverer::ProcRecFileHdr(), Rate(), Rd(), bea_Volume::Read(), fsc_DataCollectorStorage::ReadContent(), bea_FRI::ReadFRI(), bea_FRI::ReadFRIStart(), bea_FRIThread::ReadFromSysVol(), bea_DupReadThread::ReadMedVolume(), ReadOneBackupFromMedium(), fio_Transaction::ReadTransactionFromLog(), fio_uvListMgr::ReadUV(), bea_DiskVolume::ReadVolInfo(), bea_Volume::ReadVolInfoFromHeader(), bea_RecallThread::Recall(), i_LibraryAgentSCSI_i::Reconfigure(), df_BlockReader::ReleaseAndGetNextBlock(), i_ResourceManager_i::ReleaseResource(), i_ManagementInterface_i::RemoveMedium(), i_ManagementInterface_i::RemovePartition(), api_Partition::Reorg(), api_Partition::ReorgByColId(), api_Partition::ReorgScan(), rm_DBThread::Resume(), bea_TapeVolume::Rewind(), rm_DBThread::Run(), job_Executor::Run(), Run(), FSEvMgrThrd::Run(), pm_AssignResThread::Run(), fs_api::Run(), blk_NetWriter::Run(), blk_NetReader::Run(), blk_BufferWriter::Run(), blk_BufferReader::Run(), bea_VolumeReader::Run(), bea_TapeVolume::SeekBlock(), bea_TapeVolume::SeekEOD(), bea_TapeVolume::SeekFileMark(), rm_Operator::SelectAllDriveHosts(), rm_Operator::SelectAllLibraries(), rm_Operator::SelectAllMajorCol(), rm_Operator::SelectAllMediaByPart(), rm_Operator::SelectAllMediaPools(), rm_Operator::SelectAllMedium(), rm_Operator::SelectAllMediumVol(), rm_Operator::SelectAllMediumVolByPart(), rm_Operator::SelectAllMinorCol(), rm_Operator::SelectAllPart(), rm_Operator::SelectAllSlots(), rm_Operator::SelectDriveForMig(), i_ManagementInterface_i::ShowLibraryInventory(), SimulateMediumError(), scsi_IO::SkipAttAndDeferred(), STapeOpen(), la_SCSILibrary::Status(), hsm_FHrelc::Truncate(), i_LibraryAgentSCSI_i::Unload(), rm_Operator::Update(), rm_Operator::UpdateCollocation(), i_ManagementInterface_i::UpdateLibrary(), api_Partition::UpdateMajColSize(), i_ManagementInterface_i::UpdatePool(), i_BackEndAgent_i::UseResources(), bea_FRI::VerifyExistenceOfFileMark(), scsi_IO::WaitToBecomeReady(), blk_DiskFRIWriter::Write(), bea_MigrationThread::WriteBlock(), bea_TapeVolume::WriteFileMarks(), bea_DupWriteThread::WriteMedVolume(), bea_DiskVolume::WriteRaw(), WriteScsi(), WriteToMedium(), and api_Base::~api_Base().

00141                                       {
00142     return m_error;
00143 }

string ivd_BaseException::GetText (  )  const

Returns ivd_Exception::m_formatted, which contains full description.

Definition at line 145 of file ivd_exception.cpp.

References m_formatted.

Referenced by fs_api::AddGenericEvent(), i_HSM_i::Continue(), rm_DiskBufAllocator::DetectVolumes(), i_ReorgJob_i::InitializeVolumes(), main(), fs_api::Run(), and i_ManagementInterface_i::SetJobPriority().

00145                                         {
00146     return m_formatted;
00147 }

Here is the caller graph for this function:

string ivd_BaseException::GetDescription (  )  const

Returns ivd_Exception::m_context + m_detail.

Definition at line 149 of file ivd_exception.cpp.

References m_context, and m_detailed.

Referenced by CliConnectToHSM(), CliConnectToMIF(), i_HSM_i::Continue(), hsm_FHmigc::GetFileIDs(), main(), FSEvMgrThrd::Run(), blk_NetWriter::Run(), blk_NetReader::Run(), blk_BufferWriter::Run(), and blk_BufferReader::Run().

00149                                                {
00150     return m_context + m_detailed;
00151 }

Here is the caller graph for this function:

const string& ivd_BaseException::GetContext (  )  const [inline]

const string& ivd_BaseException::GetDetailed (  )  const [inline]

Returns ivd_Exception::m_detail.

Definition at line 54 of file ivderror.h.

Referenced by bea_VolumeReader::Run().

00054 {return m_detailed;};

Here is the caller graph for this function:

string ivd_BaseException::GetFriendly (  )  const

User friendly output of the exception.

Definition at line 218 of file ivd_exception.cpp.

References m_context, m_error, and m_errorText.

Referenced by _tmain(), i_Job_i::ActivateBea(), hsm_ActiveFH::ActiveToList(), i_ManagementInterface_i::AddMediumToPool(), i_ManagementInterface_i::AddPartition(), i_ManagementInterface_i::AddPool(), Backup(), TreeWalkBackup::CheckDir(), bea_MigrationThread::CheckFRI(), bea_FRIThread::CheckFRI(), i_HSM_i::CheckFSCvsIVDFS(), CheckRootMembersForEA(), i_MediumDupl_i::CheckTargetMedium(), i_AdminJob_i::CloseVolume(), bea_FRI::CloseVolume(), bea_FRI::CloseVolumeInRMDB(), Connect(), i_HSM_i::Continue(), bea_FRI::CopyFromDiskToMedium(), hsm_IVDFSRecoverer::CreateFile(), bea_FRI::CreateFRI(), api_Partition::CreateMajorCol(), bea_FRI::DeleteFRIOnDisk(), bea_FRI::DeleteFRIOnVolume(), bea_MicMemory::Detect(), bea_MamMemory::Detect(), bea_TapeMedium::DetectAITWORM(), bea_TapeMedium::DetectLTOWORM(), i_AdminJob_i::DetectVolumeHeader(), i_ManagementInterface_i::DisableDebug(), i_ManagementInterface_i::DisablePartition(), i_HSM_i::DoDeletion(), i_AdminJob_i::DoInitialize(), la_SCSILibrary::EjectMedium(), i_ManagementInterface_i::EnableDebug(), i_ManagementInterface_i::EnablePartition(), api_Partition::EnumMajorCollocationId(), api_Partition::EnumMinorCollocationId(), hsm_FileHeader::EventOffline(), i_Service_i::Execute(), i_RecreatedIVDFSJob_i::Execute(), i_RecallJob_i::Execute(), i_MigrationJob_i::Execute(), i_MediumCheckJob_i::Execute(), i_FSCCheckJob_i::Execute(), i_DelExpiredFilesJob_i::Execute(), i_Service_i::ExecutePy(), bea_DiskVolume::ExtendToFullBlock(), FileName2IPCFileList(), i_BackEndAgent_i::Format(), i_AdminJob_i::Format(), bea_TapeMedium::Format(), bea_DiskMedium::Format(), fsc_FLSPerVolume::fsc_FLSPerVolume(), fsc_RedunCopyDataVolStorageWriter::fsc_RedunCopyDataVolStorageWriter(), TreeWalk::GenerateDirTree(), mif_CfgRep::GetCfg(), hsm_FHmigc::GetFileIDs(), api_Partition::GetFileLocations(), api_Partition::GetFileStatus(), la_SCSILibrary::HandleDriveError(), i_BackEndAgent_i::HandleError(), i_BackEndAgent_i::i_BackEndAgent_i(), i_BackEndAgent_i::Init(), i_AdminJob_i::Initialize(), i_AdminJob_i::InitializeSingleVolume(), InputFile2IPCFileList(), scsi_IO::InqStandard(), i_LibraryAgentSCSI_i::Inventory(), api_Partition::JobStatus(), i_LibraryAgentSCSI_i::Load(), i_LibraryAgentManual_i::Load(), i_Job_i::LoadUnload(), main(), i_EfficientRecallJob_i::MediumOperationComplete(), hsm_JobListMgr::MigrateFailedJob(), api_Partition::MigrateFile(), bea_TapeDrive::Open(), i_AdminJob_i::OperateLA(), fsc_SplitStream_t::Pack(), i_HSM_i::PackFile(), PackFile(), ParseBlock(), df_BlockProxy::ParseBlockHeader(), ParseMICMediumNote(), ParseMICVolNote(), fio_File::PosWrite(), i_MaintFriJob_i::Process(), cmn_TreeWalk::PushDentries(), bea_FRI::ReadFRIStart(), bea_DiskVolume::ReadRaw(), bea_DiskVolume::ReadVolInfo(), hsm_FHADPRecall::RecallFileFromADP(), i_RecallJob_i::RecallRetry(), i_AdminJob_i::RecreateFRIandMIC(), bea_MediumMemory::Refresh(), bea_TapeMedium::RefreshMemoryInfo(), mif_CfgRep::RemoveCfg(), job_Manager::RemoveFromList(), i_ManagementInterface_i::RemovePartition(), api_Partition::Reorg(), api_Partition::ReorgByColId(), api_Partition::ReorgScan(), Run(), FSEvMgrThrd::Run(), ivd_DD::Run(), SendEmail(), SendMsg(), hsm_FHmigc::SendToPM(), bea_Medium::SetBarcode(), api_Partition::SetReferences(), STapeOpen(), i_AdminJob_i::StartBEA(), i_Component_i::StartDebug(), i_Component_i::StopDebug(), i_HSM_i::Suspend(), i_LibraryAgentSCSI_i::Unload(), i_LibraryAgentManual_i::Unload(), UnpackFile(), i_HSM_i::UnPackFile(), i_BackEndAgent_i::UpdateDriveIDs(), i_LibraryAgentSCSI_i::UpdateIDs(), i_ManagementInterface_i::UpdateLibrary(), api_Partition::UpdateMajColSize(), i_BackEndAgent_i::UpdateMediumIDs(), bea_Volume::UpdateMediumMem(), mif_PartMgr::UpdatePart(), mif_CfgRep::Upload(), bea_FRI::VerifyExistenceOfFileMark(), TreeWalk::Walk(), what(), hsm_RecallInfoGrp::WriteF(), bea_FRI::WriteFRI(), bea_DiskVolume::WriteRaw(), bea_DiskVolume::WriteVolInfo(), and api_Base::~api_Base().

00218                                             {
00219     ostringstream sstr;
00220     
00221     sstr
00222         << m_error << ": "
00223         << m_errorText << " \'"
00224         << m_context << "\'";
00225 
00226     return sstr.str();
00227 }

const char * ivd_BaseException::what (  )  const throw () [virtual]

Overloded standard exception output prints ivd_Exception::m_formatted member.

Definition at line 229 of file ivd_exception.cpp.

References GetFriendly().

00229                                                   {
00230     return GetFriendly().c_str();
00231 }

Here is the call graph for this function:

string ivd_BaseException::GetErrorText (  )  const [protected, virtual]

Member function to supply ivd_Exception::m_errorText.

Reimplemented in ivd_InternalError, ivd_SysError, ivd_Error, ivd_DFError, and ivd_DBException.

Definition at line 155 of file ivd_exception.cpp.

Referenced by FormatText().

00155                                              {
00156     return "";
00157 }

Here is the caller graph for this function:

void ivd_BaseException::FormatText ( const string &  a_className  )  [protected]

Member function to format ivd_Exception::m_formatted, used in operator<< and what().

Exception error text, formatted for output looks like:

ivd_Error: (20: Unknown IVD internal error.)  Trying to open FSC database. ::main(ut_log.cpp:190)

Parameters:
a_className class name (or ID) of a derived class to be included in the output

Definition at line 169 of file ivd_exception.cpp.

References cmn_Global::dbg, dbg_EXTAPI, dbg_LOW, dbg_THROW, g_cmn, GetErrorText(), log_Debugger::GetFlags(), log_Debugger::GetLevel(), log_FunctionTracer::GetStack(), cmn_Global::IsDbgActive(), log_DBG_m, log_DBG_STACK_m, log_ERR_m, log_FUNC_m, log_FunctionID::m_className, m_context, m_detailed, m_error, m_errorText, log_FunctionTracer::m_fcnID_p, log_FileID::m_file, log_FunctionID::m_fileID, m_formatted, log_FunctionID::m_funcName, log_FunctionID::m_line, m_log, and NULL.

00169                                                             {
00170     ostringstream formatted;
00171 
00172     m_errorText = GetErrorText();
00173 
00174     formatted 
00175         << a_className << ": (" << m_error <<  ": "
00176         << m_errorText << ") "
00177         << m_context;
00178         
00179     if (!m_detailed.empty()) {
00180         formatted << endl << m_detailed;
00181     }
00182 
00183     m_formatted = formatted.str();
00184 
00185     if (m_log) {
00186         // Log error immediatelly
00187         log_FUNC_m(_Exception_);
00188         log_ERR_m(m_formatted);
00189     }
00190     else {
00191         log_TraceStack* fstack( log_FunctionTracer::GetStack() );
00192         if (fstack != NULL && fstack->size() > 0) {
00193             // There's at least one function on stack. Use top
00194             // value on stack for the output.
00195             ostringstream sstr;
00196             const log_FunctionTracer  *thrower = fstack->back();
00197             sstr
00198                 << " "
00199                 << thrower->m_fcnID_p.m_className << "::"
00200                 << thrower->m_fcnID_p.m_funcName << "("
00201                 << thrower->m_fcnID_p.m_fileID.m_file << ":"
00202                 << thrower->m_fcnID_p.m_line << ")";
00203             m_formatted += sstr.str();
00204         }
00205     };
00206 
00207     // Write the exception to the debugging stream.
00208     if (g_cmn.IsDbgActive() && (g_cmn.dbg.GetFlags() & dbg_THROW) != 0) {
00209         log_FUNC_m(_Exception_);
00210 
00211         log_DBG_m(dbg_LOW, "## THROW: "  << m_formatted);
00212         if (!m_log && g_cmn.dbg.GetLevel() >= dbg_EXTAPI) {
00213             log_DBG_STACK_m;
00214         }
00215     };
00216 }

Here is the call graph for this function:


Friends And Related Function Documentation

IVD_CMN_DECL_d ostream& operator<< ( ostream &  a_os,
const ivd_BaseException a_ivdex 
) [friend]

Operator prints ivd_Exception::m_formatted.

Definition at line 233 of file ivd_exception.cpp.

00233                                                                      {
00234     a_os << a_ivdx.m_formatted;
00235     return a_os;
00236 }

IVD_CMN_DECL_d ostream& operator<< ( ostream &  a_os,
ivd_BaseException a_ivdex 
) [friend]

Definition at line 238 of file ivd_exception.cpp.

00238                                                                {
00239     a_os << a_ivdx.m_formatted;
00240     return a_os;
00241 }


Member Data Documentation

const int ivd_BaseException::m_error [protected]

const string ivd_BaseException::m_context [protected]

Optional description of the context, where an error has occured.

Definition at line 84 of file ivderror.h.

Referenced by FormatText(), GetDescription(), and GetFriendly().

const string ivd_BaseException::m_detailed [protected]

more detailed description

Definition at line 87 of file ivderror.h.

Referenced by FormatText(), and GetDescription().

string ivd_BaseException::m_errorText [protected]

Error text, most often acquired from ivd_Exception::m_error.

ivd_Exception always returns empty string.

Definition at line 92 of file ivderror.h.

Referenced by FormatText(), and GetFriendly().

string ivd_BaseException::m_formatted [protected]

Formatted string representation of an error.

Definition at line 95 of file ivderror.h.

Referenced by FormatText(), GetText(), and operator<<().

bool ivd_BaseException::m_log [protected]

Definition at line 97 of file ivderror.h.

Referenced by FormatText().

Reimplemented in ivd_Exception, ivd_InternalError, ivd_SysError, ivd_Error, ivd_DFError, and ivd_DBException.

Definition at line 103 of file ivderror.h.


The documentation for this class was generated from the following files:

Generated on Mon Feb 27 19:41:18 2012 for OPENARCHIVE by  doxygen 1.5.6