Skip to content

Commit

Permalink
Slightly improve RaidFile error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
qris committed May 14, 2017
1 parent b3f3b54 commit cc81396
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/raidfile/RaidFileWrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@ void RaidFileWrite::TransformToRaidStorage()
:blockSize;
if(::write(((l&1)==0)?stripe1:stripe2, writeFrom, toWrite) != toWrite)
{
THROW_EXCEPTION(RaidFileException, OSError)
THROW_SYS_FILE_ERROR("Failed to write to permanent RAID file",
writeFilename, RaidFileException, OSError);
}

// Next block
Expand All @@ -644,7 +645,8 @@ void RaidFileWrite::TransformToRaidStorage()
// Error on read?
if(bytesRead == -1)
{
THROW_EXCEPTION(RaidFileException, OSError)
THROW_SYS_FILE_ERROR("Failed to read from temporary RAID file", writeFilename,
RaidFileException, OSError);
}

// Special case for zero length files
Expand All @@ -662,9 +664,8 @@ void RaidFileWrite::TransformToRaidStorage()
ASSERT((::lseek(parity, 0, SEEK_CUR) % blockSize) == 0);
if(::write(parity, &sw, sizeof(sw)) != sizeof(sw))
{
BOX_LOG_SYS_ERROR("Failed to write to file: " <<
writeFilename);
THROW_EXCEPTION(RaidFileException, OSError)
THROW_SYS_FILE_ERROR("Failed to write to file", writeFilename,
RaidFileException, OSError);
}
}

Expand Down Expand Up @@ -695,7 +696,7 @@ void RaidFileWrite::TransformToRaidStorage()
|| ::rename(stripe2FilenameW.c_str(), stripe2Filename.c_str()) != 0
|| ::rename(parityFilenameW.c_str(), parityFilename.c_str()) != 0)
{
THROW_EXCEPTION(RaidFileException, OSError)
THROW_SYS_ERROR("Failed to rename file", RaidFileException, OSError);
}

// Close the write file
Expand All @@ -704,9 +705,8 @@ void RaidFileWrite::TransformToRaidStorage()
// Finally delete the write file
if(EMU_UNLINK(writeFilename.c_str()) != 0)
{
BOX_LOG_SYS_ERROR("Failed to delete file: " <<
writeFilename);
THROW_EXCEPTION(RaidFileException, OSError)
THROW_SYS_FILE_ERROR("Failed to delete file", writeFilename,
RaidFileException, OSError);
}
}
catch(...)
Expand Down

0 comments on commit cc81396

Please sign in to comment.