Internal change
PiperOrigin-RevId: 512457466
This commit is contained in:
parent
17466fb7f1
commit
1575e7f79c
|
@ -18,15 +18,16 @@
|
|||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/str_join.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace mediapipe {
|
||||
namespace tool {
|
||||
|
||||
absl::Status StatusInvalid(const std::string& message) {
|
||||
absl::Status StatusInvalid(absl::string_view message) {
|
||||
return absl::Status(absl::StatusCode::kInvalidArgument, message);
|
||||
}
|
||||
|
||||
absl::Status StatusFail(const std::string& message) {
|
||||
absl::Status StatusFail(absl::string_view message) {
|
||||
return absl::Status(absl::StatusCode::kUnknown, message);
|
||||
}
|
||||
|
||||
|
@ -35,12 +36,12 @@ absl::Status StatusStop() {
|
|||
"mediapipe::tool::StatusStop()");
|
||||
}
|
||||
|
||||
absl::Status AddStatusPrefix(const std::string& prefix,
|
||||
absl::Status AddStatusPrefix(absl::string_view prefix,
|
||||
const absl::Status& status) {
|
||||
return absl::Status(status.code(), absl::StrCat(prefix, status.message()));
|
||||
}
|
||||
|
||||
absl::Status CombinedStatus(const std::string& general_comment,
|
||||
absl::Status CombinedStatus(absl::string_view general_comment,
|
||||
const std::vector<absl::Status>& statuses) {
|
||||
// The final error code is absl::StatusCode::kUnknown if not all
|
||||
// the error codes are the same. Otherwise it is the same error code
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "mediapipe/framework/port/status.h"
|
||||
|
||||
namespace mediapipe {
|
||||
|
@ -34,16 +35,16 @@ absl::Status StatusStop();
|
|||
// Return a status which signals an invalid initial condition (for
|
||||
// example an InputSidePacket does not include all necessary fields).
|
||||
ABSL_DEPRECATED("Use absl::InvalidArgumentError(error_message) instead.")
|
||||
absl::Status StatusInvalid(const std::string& error_message);
|
||||
absl::Status StatusInvalid(absl::string_view error_message);
|
||||
|
||||
// Return a status which signals that something unexpectedly failed.
|
||||
ABSL_DEPRECATED("Use absl::UnknownError(error_message) instead.")
|
||||
absl::Status StatusFail(const std::string& error_message);
|
||||
absl::Status StatusFail(absl::string_view error_message);
|
||||
|
||||
// Prefixes the given string to the error message in status.
|
||||
// This function should be considered internal to the framework.
|
||||
// TODO Replace usage of AddStatusPrefix with util::Annotate().
|
||||
absl::Status AddStatusPrefix(const std::string& prefix,
|
||||
absl::Status AddStatusPrefix(absl::string_view prefix,
|
||||
const absl::Status& status);
|
||||
|
||||
// Combine a vector of absl::Status into a single composite status.
|
||||
|
@ -51,7 +52,7 @@ absl::Status AddStatusPrefix(const std::string& prefix,
|
|||
// will be returned.
|
||||
// This function should be considered internal to the framework.
|
||||
// TODO Move this function to somewhere with less visibility.
|
||||
absl::Status CombinedStatus(const std::string& general_comment,
|
||||
absl::Status CombinedStatus(absl::string_view general_comment,
|
||||
const std::vector<absl::Status>& statuses);
|
||||
|
||||
} // namespace tool
|
||||
|
|
Loading…
Reference in New Issue
Block a user