Make a Status with a code, error message and payload, and also send it to LOG( ) using the given filename and line (unless should_log is false, or log_severity is NUM_SEVERITIES). If should_log_stack_trace is true, the stack trace is included in the log message (ignored if should_log is false).
| 73 | // trace is included in the log message (ignored if should_log is |
| 74 | // false). |
| 75 | static Status MakeError(const char* filename, int line, |
| 76 | tensorflow::error::Code code, const string& message, |
| 77 | bool should_log, int log_severity, |
| 78 | bool should_log_stack_trace) { |
| 79 | if (TF_PREDICT_FALSE(code == tensorflow::error::OK)) { |
| 80 | LOG(ERROR) << "Cannot create error with status OK"; |
| 81 | code = tensorflow::error::UNKNOWN; |
| 82 | } |
| 83 | const Status status = MakeStatus(code, message); |
| 84 | if (TF_PREDICT_TRUE(should_log)) { |
| 85 | LogError(status, filename, line, log_severity, should_log_stack_trace); |
| 86 | } |
| 87 | return status; |
| 88 | } |
| 89 | |
| 90 | // This method is written out-of-line rather than in the header to avoid |
| 91 | // generating a lot of inline code for error cases in all callers. |
no test coverage detected