| 133 | XlaBuilder::~XlaBuilder() {} |
| 134 | |
| 135 | XlaOp XlaBuilder::ReportError(const Status& error) { |
| 136 | CHECK(!error.ok()); |
| 137 | if (die_immediately_on_error_) { |
| 138 | LOG(FATAL) << "error building computation: " << error; |
| 139 | } |
| 140 | |
| 141 | if (first_error_.ok()) { |
| 142 | first_error_ = error; |
| 143 | first_error_backtrace_.CreateCurrent(/*skip_count=*/1); |
| 144 | } |
| 145 | return XlaOp(this); |
| 146 | } |
| 147 | |
| 148 | XlaOp XlaBuilder::ReportErrorOrReturn(const StatusOr<XlaOp>& op) { |
| 149 | if (!first_error_.ok()) { |