Updated error handling

This commit is contained in:
Uwe Seimet 2021-08-22 18:17:42 +02:00
parent c5b7f2ffd4
commit 5e20391ebd
2 changed files with 13 additions and 4 deletions

View File

@ -18,6 +18,7 @@
#include "gpiobus.h"
#include "devices/scsi_host_bridge.h"
#include "devices/scsi_daynaport.h"
#include "exceptions.h"
#include <sstream>
//===========================================================================
@ -368,7 +369,14 @@ void SASIDEV::Command()
ctrl.blocks = 0;
// Execution Phase
Execute();
try {
Execute();
}
catch (const lun_exception& e) {
LOGINFO("%s Invalid LUN %d for ID %d", __PRETTY_FUNCTION__, e.getlun(), GetSCSIID());
Error(ERROR_CODES::sense_key::ILLEGAL_REQUEST, ERROR_CODES::asc::INVALID_LUN);
}
}
}

View File

@ -241,16 +241,17 @@ void SCSIDEV::Execute()
ctrl.blocks = 1;
ctrl.execstart = SysTimer::GetTimerLow();
ctrl.device = ctrl.unit[GetLun()];
try {
ctrl.device->Dispatch(this);
ctrl.device = ctrl.unit[GetLun()];
}
catch (const lun_exception& e) {
LOGINFO("%s Invalid LUN %d", __PRETTY_FUNCTION__, e.getlun());
Error(ERROR_CODES::sense_key::ILLEGAL_REQUEST, ERROR_CODES::asc::INVALID_LUN);
return;
}
ctrl.device->Dispatch(this);
}
//---------------------------------------------------------------------------