Skip to content
Snippets Groups Projects
Commit 7ab19fb2 authored by przydatek's avatar przydatek Committed by Copybara-Service
Browse files

Internal change.

PiperOrigin-RevId: 258360247
parent 1702ba49
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment