mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-29 20:34:56 +01:00
Improved error messages
This commit is contained in:
parent
b8c04ddab2
commit
9b8526b451
2 changed files with 17 additions and 3 deletions
|
@ -324,7 +324,19 @@ unsigned int makenode(const wchar_t *iPrefix, ostream &outfile,
|
|||
newEdge.ptr = 0;
|
||||
newEdge.term = 0;
|
||||
newEdge.last = 0;
|
||||
newEdge.chr = iHeader.getCodeFromChar(*global_endstring++ = *global_input++);
|
||||
try
|
||||
{
|
||||
newEdge.chr = iHeader.getCodeFromChar(*global_endstring++ = *global_input++);
|
||||
}
|
||||
catch (DicException &e)
|
||||
{
|
||||
// If an invalid character is found, be specific about the problem
|
||||
ostringstream oss;
|
||||
oss << "Error on line " << 1 + ioHeaderInfo.nwords
|
||||
<< ", col " << global_endstring - global_stringbuf
|
||||
<< ": " << e.what() << endl;
|
||||
throw DicException(oss.str());
|
||||
}
|
||||
edges.push_back(newEdge);
|
||||
|
||||
// End of a word?
|
||||
|
|
|
@ -250,8 +250,10 @@ unsigned int Header::getCodeFromChar(wchar_t iChar) const
|
|||
m_mapCodeFromChar.find(iChar);
|
||||
if (pair == m_mapCodeFromChar.end())
|
||||
{
|
||||
throw DicException("Header::getCodeFromChar: No code for letter " +
|
||||
convertToMb(iChar));
|
||||
char s[5];
|
||||
sprintf(s, "%d", iChar);
|
||||
throw DicException("Header::getCodeFromChar: No code for letter '" +
|
||||
convertToMb(iChar) + "' (val=" + string(s) + ")");
|
||||
}
|
||||
return pair->second;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue