rm CmdErrorNetworkNotLinked and just use error

This commit is contained in:
James Cherry 2021-03-05 10:03:42 -07:00
parent a7e366c414
commit 66c13decad
1 changed files with 4 additions and 17 deletions

View File

@ -108,21 +108,6 @@ typedef StringSeq TmpStringSeq;
using std::vector;
class CmdErrorNetworkNotLinked : public Exception
{
public:
virtual const char *what() const noexcept
{ return "no network has been linked."; }
};
class CmdErrorNetworkNotEditable : public Exception
{
public:
virtual const char *what() const noexcept
{ return "network does not support edits."; }
};
// Get the network for commands.
Network *
cmdNetwork()
@ -139,7 +124,8 @@ cmdLinkedNetwork()
if (network->isLinked())
return network;
else {
throw CmdErrorNetworkNotLinked();
Report *report = Sta::sta()->report();
report->error(201, "no network has been linked.");
return nullptr;
}
}
@ -152,7 +138,8 @@ cmdEditNetwork()
if (network->isEditable())
return dynamic_cast<NetworkEdit*>(network);
else {
throw CmdErrorNetworkNotEditable();
Report *report = Sta::sta()->report();
report->error(202, "network does not support edits.");
return nullptr;
}
}