Replace Base::Exception with appropriate subclass
This commit is contained in:
@@ -371,7 +371,7 @@ void Cell::setDisplayUnit(const std::string &unit)
|
||||
boost::shared_ptr<App::UnitExpression> e(ExpressionParser::parseUnit(owner->sheet(), unit.c_str()));
|
||||
|
||||
if (!e)
|
||||
throw Base::Exception("Invalid unit");
|
||||
throw Base::UnitsMismatchError("Invalid unit");
|
||||
newDisplayUnit = DisplayUnit(unit, e->getUnit(), e->getScaler());
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ int Cell::decodeAlignment(const std::string & itemStr, int alignment)
|
||||
else if (itemStr == "bottom")
|
||||
alignment = (alignment & ~Cell::ALIGNMENT_VERTICAL) | Cell::ALIGNMENT_BOTTOM;
|
||||
else
|
||||
throw Base::Exception("Invalid alignment.");
|
||||
throw Base::ValueError("Invalid alignment.");
|
||||
|
||||
return alignment;
|
||||
}
|
||||
|
||||
@@ -456,13 +456,13 @@ void PropertySheet::setDisplayUnit(CellAddress address, const std::string &unit)
|
||||
void PropertySheet::setAlias(CellAddress address, const std::string &alias)
|
||||
{
|
||||
if (alias.size() > 0 && !isValidAlias(alias))
|
||||
throw Base::Exception("Invalid alias");
|
||||
throw Base::ValueError("Invalid alias");
|
||||
|
||||
const Cell * aliasedCell = getValueFromAlias(alias);
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
|
||||
if (aliasedCell != 0 && cell != aliasedCell)
|
||||
throw Base::Exception("Alias already defined.");
|
||||
throw Base::ValueError("Alias already defined.");
|
||||
|
||||
assert(cell != 0);
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ void Sheet::getCellAddress(const Property *prop, CellAddress & address)
|
||||
if (i != propAddress.end())
|
||||
address = i->second;
|
||||
else
|
||||
throw Base::Exception("Property is not a cell");
|
||||
throw Base::TypeError("Property is not a cell");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1137,14 +1137,14 @@ void Sheet::setAlias(CellAddress address, const std::string &alias)
|
||||
if (existingAlias == address.toString()) // Same as old?
|
||||
return;
|
||||
else
|
||||
throw Base::Exception("Alias already defined");
|
||||
throw Base::ValueError("Alias already defined");
|
||||
}
|
||||
else if (alias.size() == 0) // Empty?
|
||||
cells.setAlias(address, "");
|
||||
else if (isValidAlias(alias)) // Valid?
|
||||
cells.setAlias(address, alias);
|
||||
else
|
||||
throw Base::Exception("Invalid alias");
|
||||
throw Base::ValueError("Invalid alias");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6302,9 +6302,9 @@ YY_RULE_SETUP
|
||||
{
|
||||
yylval.ivalue = strtoll( ExpressionParsertext, NULL, 0 );
|
||||
if (yylval.ivalue == LLONG_MIN)
|
||||
throw Base::Exception("Integer underflow");
|
||||
throw Base::UnderflowError("Integer underflow");
|
||||
else if (yylval.ivalue == LLONG_MAX)
|
||||
throw Base::Exception("Integer overflow");
|
||||
throw Base::OverflowError("Integer overflow");
|
||||
if (yylval.ivalue == 1) { yylval.fvalue = 1; return ONE; } else return INTEGER;
|
||||
}
|
||||
YY_BREAK
|
||||
|
||||
Reference in New Issue
Block a user