improve error handling

Properly handle ierr > 0 "warnings" returned by dpchfe upon evaluation.
Report ierr value as the error's code upon an internal error.
add test infrastructure