Ignore:
Timestamp:
27/03/2011 21:30:43 (14 months ago)
Author:
chris
Message:

Improve RaidFile? error logging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/raidfile/RaidFileWrite.cpp

    r2890 r2896  
    134134                if(existance != RaidFileUtil::NoFile) 
    135135                { 
    136                         BOX_ERROR("Attempted to overwrite raidfile " << 
    137                                 mSetNumber << " " << mFilename); 
    138                         THROW_EXCEPTION(RaidFileException, CannotOverwriteExistingFile) 
     136                        THROW_FILE_ERROR("Attempted to overwrite raidfile " << 
     137                                mSetNumber, mFilename, RaidFileException, 
     138                                CannotOverwriteExistingFile); 
    139139                } 
    140140        } 
     
    151151        if(mOSFileHandle == -1) 
    152152        { 
    153                 BOX_LOG_SYS_ERROR("Failed to open file: " << writeFilename); 
    154                 THROW_EXCEPTION(RaidFileException, ErrorOpeningWriteFile) 
     153                THROW_SYS_FILE_ERROR("Failed to open RaidFile", writeFilename, 
     154                        RaidFileException, ErrorOpeningWriteFile); 
    155155        } 
    156156         
     
    318318#ifdef WIN32 
    319319        // need to delete the target first 
    320         if(::unlink(renameTo.c_str()) != 0 &&  
    321                 GetLastError() != ERROR_FILE_NOT_FOUND) 
    322         { 
    323                 BOX_LOG_WIN_ERROR("Failed to delete file: " << renameTo); 
    324                 THROW_EXCEPTION(RaidFileException, OSError) 
     320        if(::unlink(renameTo.c_str()) != 0) 
     321        { 
     322                DWORD errorNumber = GetLastError(); 
     323                if (errorNumber != ERROR_FILE_NOT_FOUND) 
     324                { 
     325                        THROW_WIN_FILE_ERRNO("Failed to delete file", renameTo, 
     326                                errorNumber, RaidFileException, OSError); 
     327                } 
    325328        } 
    326329#endif 
     
    328331        if(::rename(renameFrom.c_str(), renameTo.c_str()) != 0) 
    329332        { 
    330                 BOX_LOG_SYS_ERROR("Failed to rename file: " << renameFrom << 
    331                         " to " << renameTo); 
    332                 THROW_EXCEPTION(RaidFileException, OSError) 
     333                THROW_SYS_ERROR("Failed to rename file: " << renameFrom << 
     334                        " to " << renameTo, RaidFileException, OSError); 
    333335        } 
    334336         
     
    810812                        { 
    811813                                // No. Bad things. 
    812                                 THROW_EXCEPTION(RaidFileException, FileExistsInDirectoryCreation) 
     814                                THROW_FILE_ERROR("Failed to create RaidFile directory", 
     815                                        dn, RaidFileException, FileExistsInDirectoryCreation); 
    813816                        } 
    814817                        else 
    815818                        { 
    816                                 THROW_EXCEPTION(RaidFileException, OSError) 
     819                                THROW_FILE_ERROR("Failed to create RaidFile directory", 
     820                                        dn, RaidFileException, OSError); 
    817821                        } 
    818822                } 
Note: See TracChangeset for help on using the changeset viewer.