[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/dic compdic.cpp header.cpp
From: |
Olivier Teulière |
Subject: |
[Eliot-dev] eliot/dic compdic.cpp header.cpp |
Date: |
Sun, 21 Jun 2009 12:32:25 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 09/06/21 12:32:25
Modified files:
dic : compdic.cpp header.cpp
Log message:
Improved error messages
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/compdic.cpp?cvsroot=eliot&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/header.cpp?cvsroot=eliot&r1=1.5&r2=1.6
Patches:
Index: compdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/compdic.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- compdic.cpp 13 Jun 2009 21:44:05 -0000 1.10
+++ compdic.cpp 21 Jun 2009 12:32:25 -0000 1.11
@@ -324,7 +324,19 @@
newEdge.ptr = 0;
newEdge.term = 0;
newEdge.last = 0;
+ 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?
Index: header.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/header.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- header.cpp 13 Jun 2009 21:44:05 -0000 1.5
+++ header.cpp 21 Jun 2009 12:32:25 -0000 1.6
@@ -250,8 +250,10 @@
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;
}