Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends

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

The base exception class. More...

#include <ivderror.h>

Inheritance diagram for ivd_BaseException:
Inheritance graph
[legend]

List of all members.

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.
void GetFriendly (ostream &a_stream) const
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)

Detailed Description

The base exception class.

ivd_Exception and ivd_InternalError are derived from this class.

Definition at line 51 of file ivderror.h.


Constructor & Destructor Documentation

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

Definition at line 152 of file ivd_exception.cpp.

                                              {
}

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 131 of file ivd_exception.cpp.

    : m_error(a_error),
      m_context(a_context),
      m_log(a_logError)  {

    // Top level IVD Exception should never be thrown.
}

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

Definition at line 139 of file ivd_exception.cpp.

        :
        m_error(a_error),
        m_context(a_context),
        m_detailed(a_detailed),
        m_log(a_logError)  {
    // Top level IVD Exception should never be thrown.
}


Member Function Documentation

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 183 of file ivd_exception.cpp.

References cmn_Global::dbg, dbg_LOW, g_cmn, GetErrorText(), log_Debugger::GetFlags(), log_Debugger::GetLevel(), log_FunctionTracer::GetStack(), cmn_Global::IsDbgActive(), log_DBG_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.

                                                            {
    ostringstream formatted;

    m_errorText = GetErrorText();

    formatted
        << a_className << ": (" << m_error <<  ": "
        << m_errorText << ") "
        << m_context;

    if (!m_detailed.empty()) {
        formatted << endl << m_detailed;
    }

    m_formatted = formatted.str();

    if (m_log) {
        // Log error immediatelly
        log_FUNC_m(_Exception_);
        log_ERR_m(m_formatted);
    }
    else {
        log_TraceStack* fstack( log_FunctionTracer::GetStack() );
        if (fstack != NULL && fstack->size() > 0) {
            // There's at least one function on stack. Use top
            // value on stack for the output.
            ostringstream sstr;
            const log_FunctionTracer  *thrower = fstack->back();
            sstr
                << " "
                << thrower->m_fcnID_p.m_className << "::"
                << thrower->m_fcnID_p.m_funcName << "("
                << thrower->m_fcnID_p.m_fileID.m_file << ":"
                << thrower->m_fcnID_p.m_line << ")";
            m_formatted += sstr.str();
        }
    };

    // Write the exception to the debugging stream.
    if (g_cmn.IsDbgActive() && (g_cmn.dbg.GetFlags() & dbg_THROW) != 0) {
        log_FUNC_m(_Exception_);

        log_DBG_m(dbg_LOW, "## THROW: "  << m_formatted);
        if (!m_log && g_cmn.dbg.GetLevel() >= dbg_EXTAPI) {
            log_DBG_STACK_m;
        }
    };
}

Here is the call graph for this function:

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

Returns ivd_Exception::m_detail.

Definition at line 68 of file ivderror.h.

Referenced by bea_VolumeReader::Run().

{return m_detailed;};

Here is the caller graph for this function:

int ivd_BaseException::GetError (  )  const

Returns ivd_Exception::m_error.

Definition at line 155 of file ivd_exception.cpp.

References m_error.

Referenced by _tmain(), 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(), 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_VvCopyJob_i::Execute(), i_ReorgJob_i::Execute(), i_RedundantCopyJob_i::Execute(), i_ManagementInterface_i::FileHistory(), 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(), ClientConf_t::ReadCollocationConfiguration(), fsc_DataCollectorStorage::ReadContent(), bea_FRI::ReadFRI(), bea_FRI::ReadFRIStart(), bea_FRIThread::ReadFromSysVol(), ClientConf_t::ReadHL7Configuration(), bea_DupReadThread::ReadMedVolume(), ReadOneBackupFromMedium(), fio_Transaction::ReadTransactionFromLog(), fio_uvListMgr::ReadUV(), bea_DiskVolume::ReadVolInfo(), bea_Volume::ReadVolInfoFromHeader(), bea_RecallThread::Recall(), i_LibraryAgentSCSI_i::Reconfigure(), i_PartitionManager_i::RegisterFSID(), 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(), 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().

                                      {
    return m_error;
}

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 169 of file ivd_exception.cpp.

Referenced by FormatText().

                                             {
    return "";
}

Here is the caller graph for this function:

string ivd_BaseException::GetFriendly (  )  const

User friendly output of the exception.

Definition at line 239 of file ivd_exception.cpp.

Referenced by _tmain(), i_Job_i::ActivateBea(), hsm_ActiveFH::ActiveToList(), i_ManagementInterface_i::AddMediumToPool(), hsm_HL7CacheFile::AddMessageToCache(), 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(), i_HSM_i::Continue(), bea_FRI::CopyFromDiskToMedium(), hsm_IVDFSRecoverer::CreateFile(), bea_FRI::CreateFRI(), api_Partition::CreateMajorCol(), bea_FRI::DeleteFRIOnDisk(), bea_FRI::DeleteFRIOnVolume(), hsm_HL7CacheFile::DeleteProcessingFile(), 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::Event(), hsm_FileHeader::EventOffline(), i_VvCopyJob_i::Execute(), 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(), hsm_HL7CacheFile::hsm_HL7CacheFile(), 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(), hsm_HL7CacheFile::ReadNextFile(), bea_DiskVolume::ReadRaw(), bea_DiskVolume::ReadVolInfo(), hsm_FHADPRecall::RecallFileFromADP(), i_RecallJob_i::RecallRetry(), i_AdminJob_i::RecreateFRIandMIC(), cfg_HL7Info::Refresh(), cfg_CollocationInfo::Refresh(), 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(), FSEvMgrThrd::Run(), ivd_DD::Run(), hsm_HL7MessageProxy::RunUndetached(), hl7::SendBlock(), 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().

                                            {
    ostringstream sstr;
    GetFriendly(sstr);

    return sstr.str();
}

void ivd_BaseException::GetFriendly ( ostream &  a_stream  )  const

Definition at line 232 of file ivd_exception.cpp.

References m_context, m_error, and m_errorText.

                                                           {
    a_stream
        << m_error << ": "
        << m_errorText << " '"
        << m_context << "'";
}

string ivd_BaseException::GetText (  )  const

Returns ivd_Exception::m_formatted, which contains full description.

Definition at line 159 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().

                                        {
    return m_formatted;
}

Here is the caller graph for this function:

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

Overloded standard exception output prints ivd_Exception::m_formatted member.

Definition at line 246 of file ivd_exception.cpp.

References GetFriendly().

Referenced by hsm_HL7CacheFile::DeleteProcessingFile().

                                                  {
    return GetFriendly().c_str();
}

Here is the call graph for this function:

Here is the caller 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 250 of file ivd_exception.cpp.

                                                                     {
    a_os << a_ivdx.m_formatted;
    return a_os;
}

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

Definition at line 255 of file ivd_exception.cpp.

                                                               {
    a_os << a_ivdx.m_formatted;
    return a_os;
}


Member Data Documentation

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

Definition at line 118 of file ivderror.h.

const string ivd_BaseException::m_context [protected]

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

Definition at line 99 of file ivderror.h.

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

const string ivd_BaseException::m_detailed [protected]

more detailed description

Definition at line 102 of file ivderror.h.

Referenced by FormatText(), and GetDescription().

const int ivd_BaseException::m_error [protected]
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 107 of file ivderror.h.

Referenced by FormatText(), and GetFriendly().

string ivd_BaseException::m_formatted [protected]

Formatted string representation of an error.

Definition at line 110 of file ivderror.h.

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

bool ivd_BaseException::m_log [protected]

Definition at line 112 of file ivderror.h.

Referenced by FormatText().


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