Fix error code message for trick play error

Issue #528.

Change-Id: Ib0752960db94910038290b235f64b360cd4f2f00
This commit is contained in:
KongQun Yang 2018-12-06 17:35:53 -08:00
parent d97e531465
commit 9819adf9d6
1 changed files with 8 additions and 7 deletions

View File

@ -13,7 +13,7 @@ namespace shaka {
namespace error { namespace error {
namespace { namespace {
std::string ErrorCodeToString(Code error_code) { const char* ErrorCodeToString(Code error_code) {
switch (error_code) { switch (error_code) {
case OK: case OK:
return "OK"; return "OK";
@ -53,10 +53,12 @@ std::string ErrorCodeToString(Code error_code) {
return "NOT_FOUND"; return "NOT_FOUND";
case ALREADY_EXISTS: case ALREADY_EXISTS:
return "ALREADY_EXISTS"; return "ALREADY_EXISTS";
default: case TRICK_PLAY_ERROR:
return "TRICK_PLAY_ERROR";
}
NOTIMPLEMENTED() << "Unknown Status Code: " << error_code; NOTIMPLEMENTED() << "Unknown Status Code: " << error_code;
return "UNKNOWN_STATUS"; return "UNKNOWN_STATUS";
}
} }
} // namespace } // namespace
} // namespace error } // namespace error
@ -82,9 +84,8 @@ std::string Status::ToString() const {
if (error_code_ == error::OK) if (error_code_ == error::OK)
return "OK"; return "OK";
return base::StringPrintf("%d (%s): %s", return base::StringPrintf("%d (%s): %s", error_code_,
error_code_, error::ErrorCodeToString(error_code_),
error::ErrorCodeToString(error_code_).c_str(),
error_message_.c_str()); error_message_.c_str());
} }