Used more specific exception classes to allow the TC to handle device failure errors better
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "AtmelIce.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
#include "src/TargetController/Exceptions/DeviceFailure.hpp"
|
||||
#include "src/TargetController/Exceptions/DeviceInitializationFailure.hpp"
|
||||
|
||||
using namespace Bloom::DebugToolDrivers;
|
||||
using namespace Protocols::CmsisDap::Edbg::Avr;
|
||||
@@ -54,7 +56,9 @@ std::string AtmelIce::getSerialNumber() {
|
||||
);
|
||||
|
||||
if (response.getResponseId() != CommandFrames::Discovery::ResponseId::OK) {
|
||||
throw Exception("Failed to fetch serial number from device - invalid Discovery Protocol response ID.");
|
||||
throw DeviceInitializationFailure(
|
||||
"Failed to fetch serial number from device - invalid Discovery Protocol response ID."
|
||||
);
|
||||
}
|
||||
|
||||
auto data = response.getPayloadData();
|
||||
@@ -68,7 +72,7 @@ void AtmelIce::startSession() {
|
||||
|
||||
if (response.getResponseId() == CommandFrames::HouseKeeping::ResponseId::FAILED) {
|
||||
// Failed response returned!
|
||||
throw Exception("Failed to start session with Atmel-ICE!");
|
||||
throw DeviceInitializationFailure("Failed to start session with Atmel-ICE!");
|
||||
}
|
||||
|
||||
this->sessionStarted = true;
|
||||
@@ -81,7 +85,7 @@ void AtmelIce::endSession() {
|
||||
|
||||
if (response.getResponseId() == CommandFrames::HouseKeeping::ResponseId::FAILED) {
|
||||
// Failed response returned!
|
||||
throw Exception("Failed to end session with Atmel-ICE!");
|
||||
throw DeviceFailure("Failed to end session with Atmel-ICE!");
|
||||
}
|
||||
|
||||
this->sessionStarted = false;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "MplabSnap.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
#include "src/TargetController/Exceptions/DeviceFailure.hpp"
|
||||
#include "src/TargetController/Exceptions/DeviceInitializationFailure.hpp"
|
||||
|
||||
using namespace Bloom::DebugToolDrivers;
|
||||
using namespace Protocols::CmsisDap::Edbg::Avr;
|
||||
@@ -46,7 +48,9 @@ std::string MplabSnap::getSerialNumber() {
|
||||
);
|
||||
|
||||
if (response.getResponseId() != CommandFrames::Discovery::ResponseId::OK) {
|
||||
throw Exception("Failed to fetch serial number from device - invalid Discovery Protocol response ID.");
|
||||
throw DeviceInitializationFailure(
|
||||
"Failed to fetch serial number from device - invalid Discovery Protocol response ID."
|
||||
);
|
||||
}
|
||||
|
||||
auto data = response.getPayloadData();
|
||||
@@ -60,7 +64,7 @@ void MplabSnap::startSession() {
|
||||
|
||||
if (response.getResponseId() == CommandFrames::HouseKeeping::ResponseId::FAILED) {
|
||||
// Failed response returned!
|
||||
throw Exception("Failed to start session with MPLAB Snap!");
|
||||
throw DeviceInitializationFailure("Failed to start session with MPLAB Snap!");
|
||||
}
|
||||
|
||||
this->sessionStarted = true;
|
||||
@@ -73,7 +77,7 @@ void MplabSnap::endSession() {
|
||||
|
||||
if (response.getResponseId() == CommandFrames::HouseKeeping::ResponseId::FAILED) {
|
||||
// Failed response returned!
|
||||
throw Exception("Failed to end session with MPLAB Snap!");
|
||||
throw DeviceFailure("Failed to end session with MPLAB Snap!");
|
||||
}
|
||||
|
||||
this->sessionStarted = false;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "PowerDebugger.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
#include "src/TargetController/Exceptions/DeviceFailure.hpp"
|
||||
#include "src/TargetController/Exceptions/DeviceInitializationFailure.hpp"
|
||||
|
||||
using namespace Bloom::DebugToolDrivers;
|
||||
using namespace Protocols::CmsisDap::Edbg::Avr;
|
||||
@@ -54,7 +56,9 @@ std::string PowerDebugger::getSerialNumber() {
|
||||
);
|
||||
|
||||
if (response.getResponseId() != CommandFrames::Discovery::ResponseId::OK) {
|
||||
throw Exception("Failed to fetch serial number from device - invalid Discovery Protocol response ID.");
|
||||
throw DeviceInitializationFailure(
|
||||
"Failed to fetch serial number from device - invalid Discovery Protocol response ID."
|
||||
);
|
||||
}
|
||||
|
||||
auto data = response.getPayloadData();
|
||||
@@ -68,7 +72,9 @@ void PowerDebugger::startSession() {
|
||||
|
||||
if (response.getResponseId() == CommandFrames::HouseKeeping::ResponseId::FAILED) {
|
||||
// Failed response returned!
|
||||
throw Exception("Failed to start session with the Power Debugger - device returned failed response ID");
|
||||
throw DeviceInitializationFailure(
|
||||
"Failed to start session with the Power Debugger - device returned failed response ID"
|
||||
);
|
||||
}
|
||||
|
||||
this->sessionStarted = true;
|
||||
@@ -81,7 +87,7 @@ void PowerDebugger::endSession() {
|
||||
|
||||
if (response.getResponseId() == CommandFrames::HouseKeeping::ResponseId::FAILED) {
|
||||
// Failed response returned!
|
||||
throw Exception("Failed to end session with the Power Debugger - device returned failed response ID");
|
||||
throw DeviceFailure("Failed to end session with the Power Debugger - device returned failed response ID");
|
||||
}
|
||||
|
||||
this->sessionStarted = false;
|
||||
|
||||
Reference in New Issue
Block a user