tf.errors.raise_exception_on_not_ok_status(*args, **kwds)

tf.errors.raise_exception_on_not_ok_status(*args, **kwds)

See the guide: Running Graphs > Error classes and convenience functions