From 7ab19fb22a217596607532b8c218e439a396d4e9 Mon Sep 17 00:00:00 2001 From: przydatek <przydatek@google.com> Date: Tue, 16 Jul 2019 07:04:07 -0700 Subject: [PATCH] Internal change. PiperOrigin-RevId: 258360247 --- python/util/clif.cc | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/python/util/clif.cc b/python/util/clif.cc index c440e11d3..9aa448416 100644 --- a/python/util/clif.cc +++ b/python/util/clif.cc @@ -16,13 +16,10 @@ #include "tink/python/util/clif.h" -#include "google/protobuf/message_set.pb.h" #include "absl/strings/str_cat.h" -#include "tink/util/canonical_errors.h" +#include "tink/util/status.h" + -#if !defined(PORTABLE_STATUS) -#include "tink/util/status_payload.h" -#endif namespace crypto { namespace tink { @@ -69,29 +66,29 @@ Status StatusFromPyException() { } if (PyErr_ExceptionMatches(PyExc_MemoryError)) { - return ::util::ResourceExhaustedError(PyExcFetch()); + return Status(util::error::RESOURCE_EXHAUSTED, PyExcFetch()); } if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) { - return ::util::UnimplementedError(PyExcFetch()); + return Status(util::error::UNIMPLEMENTED, PyExcFetch()); } if (PyErr_ExceptionMatches(PyExc_KeyboardInterrupt)) { - return ::util::AbortedError(PyExcFetch()); + return Status(util::error::ABORTED, PyExcFetch()); } if (PyErr_ExceptionMatches(PyExc_SystemError) || PyErr_ExceptionMatches(PyExc_SyntaxError)) { - return ::util::InternalError(PyExcFetch()); + return Status(util::error::INTERNAL, PyExcFetch()); } if (PyErr_ExceptionMatches(PyExc_TypeError)) { - return ::util::InvalidArgumentError(PyExcFetch()); + return Status(util::error::INVALID_ARGUMENT, PyExcFetch()); } if (PyErr_ExceptionMatches(PyExc_ValueError)) { - return ::util::OutOfRangeError(PyExcFetch()); + return Status(util::error::OUT_OF_RANGE, PyExcFetch()); } if (PyErr_ExceptionMatches(PyExc_LookupError)) { - return ::util::NotFoundError(PyExcFetch()); + return Status(util::error::NOT_FOUND, PyExcFetch()); } - return ::util::UnknownError(PyExcFetch()); + return Status(util::error::UNKNOWN, PyExcFetch()); } PyObject* Clif_PyObjFrom(const Status& c, const clif::py::PostConv& unused) { -- GitLab