7 #include "packager/status.h" 9 #include "packager/base/logging.h" 10 #include "packager/base/strings/stringprintf.h" 16 const char* ErrorCodeToString(Code error_code) {
24 case INVALID_ARGUMENT:
25 return "INVALID_ARGUMENT";
27 return "UNIMPLEMENTED";
29 return "FILE_FAILURE";
31 return "END_OF_STREAM";
33 return "HTTP_FAILURE";
35 return "PARSER_FAILURE";
36 case ENCRYPTION_FAILURE:
37 return "ENCRYPTION_FAILURE";
39 return "CHUNKING_ERROR";
41 return "MUXER_FAILURE";
42 case FRAGMENT_FINALIZED:
43 return "FRAGMENT_FINALIZED";
45 return "SERVER_ERROR";
47 return "INTERNAL_ERROR";
55 return "ALREADY_EXISTS";
56 case TRICK_PLAY_ERROR:
57 return "TRICK_PLAY_ERROR";
60 NOTIMPLEMENTED() <<
"Unknown Status Code: " << error_code;
61 return "UNKNOWN_STATUS";
66 const Status Status::OK = Status(error::OK,
"");
67 const Status Status::UNKNOWN = Status(error::UNKNOWN,
"");
70 : error_code_(error_code) {
72 error_message_ = error_message;
73 if (!error_message.empty())
80 *
this = std::move(new_status);
84 if (error_code_ == error::OK)
87 return base::StringPrintf(
"%d (%s): %s", error_code_,
88 error::ErrorCodeToString(error_code_),
89 error_message_.c_str());
92 std::ostream& operator<<(std::ostream& os,
const Status& x) {
std::string ToString() const
All the methods that are virtual are virtual for mocking.
Status()
Creates a "successful" status.
void Update(Status new_status)