7 #include "packager/media/base/status.h"
9 #include "packager/base/logging.h"
10 #include "packager/base/strings/stringprintf.h"
17 std::string ErrorCodeToString(Code error_code) {
25 case INVALID_ARGUMENT:
26 return "INVALID_ARGUMENT";
28 return "UNIMPLEMENTED";
30 return "FILE_FAILURE";
32 return "END_OF_STREAM";
34 return "HTTP_FAILURE";
36 return "PARSER_FAILURE";
37 case ENCRYPTION_FAILURE:
38 return "ENCRYPTION_FAILURE";
40 return "CHUNKING_ERROR";
42 return "MUXER_FAILURE";
43 case FRAGMENT_FINALIZED:
44 return "FRAGMENT_FINALIZED";
46 return "SERVER_ERROR";
48 return "INTERNAL_ERROR";
56 return "ALREADY_EXISTS";
58 NOTIMPLEMENTED() <<
"Unknown Status Code: " << error_code;
59 return "UNKNOWN_STATUS";
65 const Status Status::OK = Status(error::OK,
"");
66 const Status Status::UNKNOWN = Status(error::UNKNOWN,
"");
69 if (error_code_ == error::OK)
72 return base::StringPrintf(
"%d (%s): %s",
74 error::ErrorCodeToString(error_code_).c_str(),
75 error_message_.c_str());
78 std::ostream& operator<<(std::ostream& os,
const Status& x) {