Use catch/3
. Example:
?- catch(p, error(type_error(_,_),_), false).
false.
It is declaratively perfectly OK to replace type errors by silent failure like this. This is not true for instantiation errors, since an instantiation error can turn to solutions when you add more goals, but a type error can not.