mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Automated rollback of commit 4eede550e7
.
PiperOrigin-RevId: 295946052 Change-Id: Ie8c23fe8eec99ab52245ae7f482f1e6b99ec010e
This commit is contained in:
parent
4eede550e7
commit
e56f562fe2
|
@ -27,6 +27,7 @@
|
|||
#include "sandboxed_api/sandbox2/util/fileops.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/raw_logging.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
|
||||
namespace file_util = ::sandbox2::file_util;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "sandboxed_api/transaction.h"
|
||||
#include "sandboxed_api/util/status_matchers.h"
|
||||
#include "sandboxed_api/vars.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "sandboxed_api/examples/sum/lib/sum_params.pb.h"
|
||||
#include "sandboxed_api/transaction.h"
|
||||
#include "sandboxed_api/vars.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "sandboxed_api/proto_arg.pb.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
#include "sandboxed_api/util/statusor.h"
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "absl/synchronization/mutex.h"
|
||||
#include "sandboxed_api/call.h"
|
||||
#include "sandboxed_api/sandbox2/comms.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
namespace sapi {
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "sandboxed_api/sandbox2/util/fileops.h"
|
||||
#include "sandboxed_api/sandbox2/util/path.h"
|
||||
#include "sandboxed_api/sandbox2/util/runfiles.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
namespace file = ::sandbox2::file;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "absl/strings/str_cat.h"
|
||||
#include "sandboxed_api/sandbox2/util.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "sandboxed_api/sandbox2/sanitizer.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/raw_logging.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "sandboxed_api/sandbox2/util/fileops.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/raw_logging.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
#include "sandboxed_api/util/statusor.h"
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "sandboxed_api/sandbox2/util/path.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/raw_logging.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
#include "sandboxed_api/util/statusor.h"
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "sandboxed_api/sandbox2/namespace.h"
|
||||
#include "sandboxed_api/sandbox2/util/bpf_helper.h"
|
||||
#include "sandboxed_api/sandbox2/util/path.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "absl/strings/str_cat.h"
|
||||
#include "sandboxed_api/sandbox2/syscall.h"
|
||||
#include "sandboxed_api/sandbox2/util.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "absl/time/time.h"
|
||||
#include "sandboxed_api/sandbox2/monitor.h"
|
||||
#include "sandboxed_api/sandbox2/result.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "sandboxed_api/sandbox2/util/path.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/raw_logging.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
namespace util {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "sandboxed_api/sandbox2/util/maps_parser.h"
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "sandboxed_api/sandbox2/util.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/raw_logging.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "absl/strings/str_cat.h"
|
||||
#include "sandboxed_api/sandbox2/util/fileops.h"
|
||||
#include "sandboxed_api/sandbox2/util/strerror.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "sandboxed_api/transaction.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
namespace sapi {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "sandboxed_api/sandbox.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
|
|
|
@ -28,8 +28,12 @@ sapi_proto_library(
|
|||
# replaced once Abseil releases absl::Status.
|
||||
cc_library(
|
||||
name = "status",
|
||||
srcs = ["status.cc"],
|
||||
srcs = [
|
||||
"canonical_errors.cc",
|
||||
"status.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"canonical_errors.h",
|
||||
"status.h",
|
||||
"status_internal.h",
|
||||
"status_macros.h",
|
||||
|
|
|
@ -28,6 +28,8 @@ target_link_libraries(sapi_util_status_proto
|
|||
|
||||
# sandboxed_api/util:status
|
||||
add_library(sapi_util_status STATIC
|
||||
canonical_errors.cc
|
||||
canonical_errors.h
|
||||
status.cc
|
||||
status.h
|
||||
status_internal.h
|
||||
|
|
117
sandboxed_api/util/canonical_errors.cc
Normal file
117
sandboxed_api/util/canonical_errors.cc
Normal file
|
@ -0,0 +1,117 @@
|
|||
// Copyright 2019 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
|
||||
namespace sapi {
|
||||
|
||||
Status AbortedError(absl::string_view message) {
|
||||
return Status{StatusCode::kAborted, message};
|
||||
}
|
||||
Status AlreadyExistsError(absl::string_view message) {
|
||||
return Status{StatusCode::kAlreadyExists, message};
|
||||
}
|
||||
Status CancelledError(absl::string_view message) {
|
||||
return Status{StatusCode::kCancelled, message};
|
||||
}
|
||||
Status DataLossError(absl::string_view message) {
|
||||
return Status{StatusCode::kDataLoss, message};
|
||||
}
|
||||
Status DeadlineExceededError(absl::string_view message) {
|
||||
return Status{StatusCode::kDeadlineExceeded, message};
|
||||
}
|
||||
Status FailedPreconditionError(absl::string_view message) {
|
||||
return Status{StatusCode::kFailedPrecondition, message};
|
||||
}
|
||||
Status InternalError(absl::string_view message) {
|
||||
return Status{StatusCode::kInternal, message};
|
||||
}
|
||||
Status InvalidArgumentError(absl::string_view message) {
|
||||
return Status{StatusCode::kInvalidArgument, message};
|
||||
}
|
||||
Status NotFoundError(absl::string_view message) {
|
||||
return Status{StatusCode::kNotFound, message};
|
||||
}
|
||||
Status OutOfRangeError(absl::string_view message) {
|
||||
return Status{StatusCode::kOutOfRange, message};
|
||||
}
|
||||
Status PermissionDeniedError(absl::string_view message) {
|
||||
return Status{StatusCode::kPermissionDenied, message};
|
||||
}
|
||||
Status ResourceExhaustedError(absl::string_view message) {
|
||||
return Status{StatusCode::kResourceExhausted, message};
|
||||
}
|
||||
Status UnauthenticatedError(absl::string_view message) {
|
||||
return Status{StatusCode::kUnauthenticated, message};
|
||||
}
|
||||
Status UnavailableError(absl::string_view message) {
|
||||
return Status{StatusCode::kUnavailable, message};
|
||||
}
|
||||
Status UnimplementedError(absl::string_view message) {
|
||||
return Status{StatusCode::kUnimplemented, message};
|
||||
}
|
||||
Status UnknownError(absl::string_view message) {
|
||||
return Status{StatusCode::kUnknown, message};
|
||||
}
|
||||
|
||||
bool IsAborted(const Status& status) {
|
||||
return status.code() == StatusCode::kAborted;
|
||||
}
|
||||
bool IsAlreadyExists(const Status& status) {
|
||||
return status.code() == StatusCode::kAlreadyExists;
|
||||
}
|
||||
bool IsCancelled(const Status& status) {
|
||||
return status.code() == StatusCode::kCancelled;
|
||||
}
|
||||
bool IsDataLoss(const Status& status) {
|
||||
return status.code() == StatusCode::kDataLoss;
|
||||
}
|
||||
bool IsDeadlineExceeded(const Status& status) {
|
||||
return status.code() == StatusCode::kDeadlineExceeded;
|
||||
}
|
||||
bool IsFailedPrecondition(const Status& status) {
|
||||
return status.code() == StatusCode::kFailedPrecondition;
|
||||
}
|
||||
bool IsInternal(const Status& status) {
|
||||
return status.code() == StatusCode::kInternal;
|
||||
}
|
||||
bool IsInvalidArgument(const Status& status) {
|
||||
return status.code() == StatusCode::kInvalidArgument;
|
||||
}
|
||||
bool IsNotFound(const Status& status) {
|
||||
return status.code() == StatusCode::kNotFound;
|
||||
}
|
||||
bool IsOutOfRange(const Status& status) {
|
||||
return status.code() == StatusCode::kOutOfRange;
|
||||
}
|
||||
bool IsPermissionDenied(const Status& status) {
|
||||
return status.code() == StatusCode::kPermissionDenied;
|
||||
}
|
||||
bool IsResourceExhausted(const Status& status) {
|
||||
return status.code() == StatusCode::kResourceExhausted;
|
||||
}
|
||||
bool IsUnauthenticated(const Status& status) {
|
||||
return status.code() == StatusCode::kUnauthenticated;
|
||||
}
|
||||
bool IsUnavailable(const Status& status) {
|
||||
return status.code() == StatusCode::kUnavailable;
|
||||
}
|
||||
bool IsUnimplemented(const Status& status) {
|
||||
return status.code() == StatusCode::kUnimplemented;
|
||||
}
|
||||
bool IsUnknown(const Status& status) {
|
||||
return status.code() == StatusCode::kUnknown;
|
||||
}
|
||||
|
||||
} // namespace sapi
|
67
sandboxed_api/util/canonical_errors.h
Normal file
67
sandboxed_api/util/canonical_errors.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Copyright 2019 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef SANDBOXED_API_UTIL_CANONICAL_ERRORS_H_
|
||||
#define SANDBOXED_API_UTIL_CANONICAL_ERRORS_H_
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
|
||||
namespace sapi {
|
||||
|
||||
// Each of the functions below creates a canonical error with the given
|
||||
// message. The error code of the returned status object matches the name of
|
||||
// the function.
|
||||
Status AbortedError(absl::string_view message);
|
||||
Status AlreadyExistsError(absl::string_view message);
|
||||
Status CancelledError(absl::string_view message);
|
||||
Status DataLossError(absl::string_view message);
|
||||
Status DeadlineExceededError(absl::string_view message);
|
||||
Status FailedPreconditionError(absl::string_view message);
|
||||
Status InternalError(absl::string_view message);
|
||||
Status InvalidArgumentError(absl::string_view message);
|
||||
Status NotFoundError(absl::string_view message);
|
||||
Status OutOfRangeError(absl::string_view message);
|
||||
Status PermissionDeniedError(absl::string_view message);
|
||||
Status ResourceExhaustedError(absl::string_view message);
|
||||
Status UnauthenticatedError(absl::string_view message);
|
||||
Status UnavailableError(absl::string_view message);
|
||||
Status UnimplementedError(absl::string_view message);
|
||||
Status UnknownError(absl::string_view message);
|
||||
|
||||
// Each of the functions below returns true if the given status matches the
|
||||
// canonical error code implied by the function's name. If necessary, the
|
||||
// status will be converted to the canonical error space to perform the
|
||||
// comparison.
|
||||
ABSL_MUST_USE_RESULT bool IsAborted(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsAlreadyExists(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsCancelled(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsDataLoss(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsDeadlineExceeded(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsFailedPrecondition(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsInternal(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsInvalidArgument(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsNotFound(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsOutOfRange(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsPermissionDenied(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsResourceExhausted(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsUnauthenticated(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsUnavailable(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsUnimplemented(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsUnknown(const Status& status);
|
||||
|
||||
} // namespace sapi
|
||||
|
||||
#endif // SANDBOXED_API_UTIL_CANONICAL_ERRORS_H_
|
|
@ -89,102 +89,4 @@ std::ostream& operator<<(std::ostream& os, const Status& status) {
|
|||
return os << status.ToString();
|
||||
}
|
||||
|
||||
Status AbortedError(absl::string_view message) {
|
||||
return Status{StatusCode::kAborted, message};
|
||||
}
|
||||
Status AlreadyExistsError(absl::string_view message) {
|
||||
return Status{StatusCode::kAlreadyExists, message};
|
||||
}
|
||||
Status CancelledError(absl::string_view message) {
|
||||
return Status{StatusCode::kCancelled, message};
|
||||
}
|
||||
Status DataLossError(absl::string_view message) {
|
||||
return Status{StatusCode::kDataLoss, message};
|
||||
}
|
||||
Status DeadlineExceededError(absl::string_view message) {
|
||||
return Status{StatusCode::kDeadlineExceeded, message};
|
||||
}
|
||||
Status FailedPreconditionError(absl::string_view message) {
|
||||
return Status{StatusCode::kFailedPrecondition, message};
|
||||
}
|
||||
Status InternalError(absl::string_view message) {
|
||||
return Status{StatusCode::kInternal, message};
|
||||
}
|
||||
Status InvalidArgumentError(absl::string_view message) {
|
||||
return Status{StatusCode::kInvalidArgument, message};
|
||||
}
|
||||
Status NotFoundError(absl::string_view message) {
|
||||
return Status{StatusCode::kNotFound, message};
|
||||
}
|
||||
Status OutOfRangeError(absl::string_view message) {
|
||||
return Status{StatusCode::kOutOfRange, message};
|
||||
}
|
||||
Status PermissionDeniedError(absl::string_view message) {
|
||||
return Status{StatusCode::kPermissionDenied, message};
|
||||
}
|
||||
Status ResourceExhaustedError(absl::string_view message) {
|
||||
return Status{StatusCode::kResourceExhausted, message};
|
||||
}
|
||||
Status UnauthenticatedError(absl::string_view message) {
|
||||
return Status{StatusCode::kUnauthenticated, message};
|
||||
}
|
||||
Status UnavailableError(absl::string_view message) {
|
||||
return Status{StatusCode::kUnavailable, message};
|
||||
}
|
||||
Status UnimplementedError(absl::string_view message) {
|
||||
return Status{StatusCode::kUnimplemented, message};
|
||||
}
|
||||
Status UnknownError(absl::string_view message) {
|
||||
return Status{StatusCode::kUnknown, message};
|
||||
}
|
||||
|
||||
bool IsAborted(const Status& status) {
|
||||
return status.code() == StatusCode::kAborted;
|
||||
}
|
||||
bool IsAlreadyExists(const Status& status) {
|
||||
return status.code() == StatusCode::kAlreadyExists;
|
||||
}
|
||||
bool IsCancelled(const Status& status) {
|
||||
return status.code() == StatusCode::kCancelled;
|
||||
}
|
||||
bool IsDataLoss(const Status& status) {
|
||||
return status.code() == StatusCode::kDataLoss;
|
||||
}
|
||||
bool IsDeadlineExceeded(const Status& status) {
|
||||
return status.code() == StatusCode::kDeadlineExceeded;
|
||||
}
|
||||
bool IsFailedPrecondition(const Status& status) {
|
||||
return status.code() == StatusCode::kFailedPrecondition;
|
||||
}
|
||||
bool IsInternal(const Status& status) {
|
||||
return status.code() == StatusCode::kInternal;
|
||||
}
|
||||
bool IsInvalidArgument(const Status& status) {
|
||||
return status.code() == StatusCode::kInvalidArgument;
|
||||
}
|
||||
bool IsNotFound(const Status& status) {
|
||||
return status.code() == StatusCode::kNotFound;
|
||||
}
|
||||
bool IsOutOfRange(const Status& status) {
|
||||
return status.code() == StatusCode::kOutOfRange;
|
||||
}
|
||||
bool IsPermissionDenied(const Status& status) {
|
||||
return status.code() == StatusCode::kPermissionDenied;
|
||||
}
|
||||
bool IsResourceExhausted(const Status& status) {
|
||||
return status.code() == StatusCode::kResourceExhausted;
|
||||
}
|
||||
bool IsUnauthenticated(const Status& status) {
|
||||
return status.code() == StatusCode::kUnauthenticated;
|
||||
}
|
||||
bool IsUnavailable(const Status& status) {
|
||||
return status.code() == StatusCode::kUnavailable;
|
||||
}
|
||||
bool IsUnimplemented(const Status& status) {
|
||||
return status.code() == StatusCode::kUnimplemented;
|
||||
}
|
||||
bool IsUnknown(const Status& status) {
|
||||
return status.code() == StatusCode::kUnknown;
|
||||
}
|
||||
|
||||
} // namespace sapi
|
||||
|
|
|
@ -123,47 +123,6 @@ inline bool operator!=(const Status& lhs, const Status& rhs) {
|
|||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
// Each of the functions below creates a canonical error with the given
|
||||
// message. The error code of the returned status object matches the name of
|
||||
// the function.
|
||||
Status AbortedError(absl::string_view message);
|
||||
Status AlreadyExistsError(absl::string_view message);
|
||||
Status CancelledError(absl::string_view message);
|
||||
Status DataLossError(absl::string_view message);
|
||||
Status DeadlineExceededError(absl::string_view message);
|
||||
Status FailedPreconditionError(absl::string_view message);
|
||||
Status InternalError(absl::string_view message);
|
||||
Status InvalidArgumentError(absl::string_view message);
|
||||
Status NotFoundError(absl::string_view message);
|
||||
Status OutOfRangeError(absl::string_view message);
|
||||
Status PermissionDeniedError(absl::string_view message);
|
||||
Status ResourceExhaustedError(absl::string_view message);
|
||||
Status UnauthenticatedError(absl::string_view message);
|
||||
Status UnavailableError(absl::string_view message);
|
||||
Status UnimplementedError(absl::string_view message);
|
||||
Status UnknownError(absl::string_view message);
|
||||
|
||||
// Each of the functions below returns true if the given status matches the
|
||||
// canonical error code implied by the function's name. If necessary, the
|
||||
// status will be converted to the canonical error space to perform the
|
||||
// comparison.
|
||||
ABSL_MUST_USE_RESULT bool IsAborted(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsAlreadyExists(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsCancelled(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsDataLoss(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsDeadlineExceeded(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsFailedPrecondition(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsInternal(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsInvalidArgument(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsNotFound(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsOutOfRange(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsPermissionDenied(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsResourceExhausted(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsUnauthenticated(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsUnavailable(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsUnimplemented(const Status& status);
|
||||
ABSL_MUST_USE_RESULT bool IsUnknown(const Status& status);
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Status& status);
|
||||
|
||||
inline void SaveStatusToProto(const Status& status, StatusProto* out) {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "sandboxed_api/sandbox2/comms.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "sandboxed_api/rpcchannel.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
namespace sapi::v {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "sandboxed_api/var_abstract.h"
|
||||
#include "sandboxed_api/var_pointable.h"
|
||||
#include "sandboxed_api/var_ptr.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
namespace sapi::v {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "sandboxed_api/var_int.h"
|
||||
#include "sandboxed_api/rpcchannel.h"
|
||||
#include "sandboxed_api/util/canonical_errors.h"
|
||||
#include "sandboxed_api/util/status_macros.h"
|
||||
|
||||
namespace sapi::v {
|
||||
|
|
Loading…
Reference in New Issue
Block a user