7 #include "packager/status.h"
9 #include "packager/base/logging.h"
10 #include "packager/base/strings/stringprintf.h"
16 std::string 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";
57 NOTIMPLEMENTED() <<
"Unknown Status Code: " << error_code;
58 return "UNKNOWN_STATUS";
64 const Status Status::OK = Status(error::OK,
"");
65 const Status Status::UNKNOWN = Status(error::UNKNOWN,
"");
68 if (error_code_ == error::OK)
71 return base::StringPrintf(
"%d (%s): %s",
73 error::ErrorCodeToString(error_code_).c_str(),
74 error_message_.c_str());
77 std::ostream& operator<<(std::ostream& os,
const Status& x) {
std::string ToString() const