error handling
This commit is contained in:
parent
2bbc3b9265
commit
f9655cccb6
|
@ -136,7 +136,7 @@ protected:
|
|||
YAPPredicate(const char *s0, Term &out, Term &names) {
|
||||
CACHE_REGS
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term *outp;
|
||||
Term *modp = NULL;;
|
||||
|
||||
out = Yap_StringToTerm(s0, strlen(s0) + 1, &LOCAL_encoding, 1200, &names);
|
||||
// extern char *s0;
|
||||
|
@ -145,7 +145,7 @@ protected:
|
|||
// delete [] ns;
|
||||
if (out == 0L)
|
||||
throw YAPError();
|
||||
ap = getPred(out, outp);
|
||||
ap = getPred(out, modp);
|
||||
RECOVER_MACHINE_REGS();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ class T(tuple):
|
|||
def query_prolog(engine, s):
|
||||
|
||||
def answer( q ):
|
||||
# try:
|
||||
return q.next()
|
||||
# except yap.YAPPythonException e:
|
||||
# print e.text()
|
||||
# return False
|
||||
try:
|
||||
return q.next()
|
||||
except Exception as e:
|
||||
print( e.args[1] )
|
||||
return False
|
||||
|
||||
q = engine.query(s)
|
||||
ask = True
|
||||
|
|
|
@ -96,7 +96,7 @@ return *new YAPTerm();
|
|||
switch (e.getErrorClass()) {
|
||||
case YAPC_NO_ERROR:
|
||||
break;
|
||||
/// bad domain, "first argument often is the predicate.
|
||||
/// bad domain, "first argument often is the predicate.
|
||||
case DOMAIN_ERROR: {
|
||||
switch (en) {
|
||||
case DOMAIN_ERROR_OUT_OF_RANGE:
|
||||
|
@ -193,8 +193,7 @@ return *new YAPTerm();
|
|||
break;
|
||||
}
|
||||
PyErr_SetString(pyerr, e.text());
|
||||
return Py_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
Reference in New Issue