- All policy-related errors should now be handled. I hope this is the last time I say this...

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@850 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-08-13 14:20:04 +00:00
parent cb4f0e878d
commit 1be6a9ca58
7 changed files with 102 additions and 36 deletions

View file

@ -374,7 +374,17 @@ TextSimulation::on_run(const Tokens& arguments)
p_stderr(e.what());
p_stderr(_("\nSimulation is now stopped, and "
"the current policy will be deactivated\n"));
Simulation::get_instance().set_policy(NULL);
try
{
Simulation::get_instance().set_policy(NULL);
}
catch(const CPUPolicyException& f)
{
// should never happen
p_stderr(_("FATAL ERROR: unable to deactivate the policy: "));
p_stderr(f.what());
abort();
}
}
catch (const NullPolicyException& e)
{
@ -666,8 +676,8 @@ TextSimulation::on_set(const Tokens& arguments)
vector<CPUPolicy*> policies = (*it)->get_avail_policies();
for (CPUPolicyIt it = policies.begin(); it != policies.end(); ++it)
{
if (policy == 0)
Simulation::get_instance().set_policy(*it);
if (policy == 0)
Simulation::get_instance().set_policy(*it);
--policy;
}
@ -680,6 +690,13 @@ TextSimulation::on_set(const Tokens& arguments)
{
p_stderr(_("ERROR: invalid unsigned integer or not a valid policy index\n"));
}
catch (const CPUPolicyException& e)
{
p_stderr(_("ERROR: "));
p_stderr(e.what());
p_stderr("\n");
}
}
else if (attr == "CONTINUOUS")
{