Commit abb09009 authored by Eric Cano's avatar Eric Cano
Browse files

Added value of response code when sense fails ASC/ASCQ lookup.

parent 14da618a
......@@ -776,7 +776,10 @@ namespace SCSI {
} else if (isDescriptorFormat()) {
return descriptorFormat.ASC;
} else {
throw Tape::Exception("In senseData_t::getASC: no ACS with this response code or response code not supported");
std::stringstream err;
err << "In senseData_t::getASC: no ACS with this response code or response code not supported ("
<< std::hex << std::showbase << (int)responseCode << ")";
throw Tape::Exception(err.str());
}
}
......@@ -786,7 +789,10 @@ namespace SCSI {
} else if (isDescriptorFormat()) {
return descriptorFormat.ASCQ;
} else {
throw Tape::Exception("In senseData_t::getASCQ: no ACSQ with this response code or response code not supported");
std::stringstream err;
err << "In senseData_t::getASCQ: no ACSQ with this response code or response code not supported ("
<< std::hex << std::showbase << (int)responseCode << ")";
throw Tape::Exception(err.str());
}
}
/**
......@@ -815,6 +821,7 @@ namespace SCSI {
snprintf(buff, sizeof (buff), "Unknown ASC/ASCQ:%02x/%02x", asc, ascq);
return std::string(buff);
}
/* TODO: add support for sense key */
};
template <size_t n>
......
......@@ -537,6 +537,12 @@ namespace UnitTests {
ASSERT_THROW(sense.getASC(), Tape::Exception);
ASSERT_THROW(sense.getACSString(), Tape::Exception);
try { sense.getACSString(); ASSERT_TRUE(false); }
catch (Tape::Exception & ex) {
std::string what(ex.shortWhat());
ASSERT_NE(std::string::npos, what.find("response code not supported (0x74)"));
}
}
TEST(SCSI_Structures, toU16) {
......@@ -576,7 +582,7 @@ namespace UnitTests {
sense.fixedFormat.ASC = 0x14;
sense.fixedFormat.ASCQ = 0x04;
ASSERT_THROW(SCSI::ExceptionLauncher(sgio), SCSI::Exception);
try { SCSI::ExceptionLauncher(sgio, "In exception validation:"); }
try { SCSI::ExceptionLauncher(sgio, "In exception validation:"); ASSERT_TRUE(false); }
catch (SCSI::Exception & ex) {
std::string what(ex.shortWhat());
ASSERT_NE(std::string::npos, what.find("Block sequence error"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment