-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyException cleanup #2597
PyException cleanup #2597
Conversation
|
||
void | ||
IcePy::PyException::raiseLocalException() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merged raiseLocalException and raise
|
||
if (PyObject_IsInstance(ex.get(), userExceptionType)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer handel user exceptions in raise. TypedUpcall::exception
always marshall user exceptions, and Invocation::unmarshalException
unmarshall exceptions and validates exception specificiation. A user exception in PyException::raise doesn't have a special meaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should remove the includeStackTrace parameter, because it should be always false. The message of an UnknownXxx exception should never include a stack trace.
python/modules/IcePy/Util.cpp
Outdated
} | ||
else | ||
|
||
string createUnknownExceptionMessage(PyObject* ex, PyObject* type, PyObject* tb, bool includeStackTrace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we have an includeStackTrace parameter here (and by extension, the type and tb parameters).
The message for an UnknownException never includes the stack trace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was to include it when it is raised by the application, and not include it when it is raised by the remote peer.
python/modules/IcePy/Util.cpp
Outdated
throw Ice::UnknownLocalException{ | ||
__FILE__, | ||
__LINE__, | ||
createUnknownExceptionMessage(ex.get(), _type.get(), _tb.get(), includeStackTrace)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should never include the stack trace here.
python/modules/IcePy/Util.cpp
Outdated
throw Ice::UnknownException{ | ||
__FILE__, | ||
__LINE__, | ||
createUnknownExceptionMessage(ex.get(), _type.get(), _tb.get(), includeStackTrace)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
python/modules/IcePy/Util.h
Outdated
@@ -89,7 +89,7 @@ namespace IcePy | |||
// | |||
// Convert the Python exception to its C++ equivalent. | |||
// | |||
void raise(); | |||
void raise(bool includeStackTrace); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From reading the code, that's not really what raise() does. It converts the Python exception into one of the 6 special Ice local exceptions. And as a result, we don't need an includeStackTrace parameter for this function.
Rewoked to never include stack trace with unknown exceptions. |
python/modules/IcePy/Util.cpp
Outdated
} | ||
|
||
void | ||
IcePy::PyException::raise() | ||
namespace IcePy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should use the same style as the rest:
string
IcePy::getTypeName(...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I move them to the .cpp file because they are local to this file. Updated the code to use tne anonymous namespace instead of IcePy to make it clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
python/modules/IcePy/Util.cpp
Outdated
} | ||
|
||
void | ||
IcePy::PyException::raise() | ||
namespace IcePy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intend to use the anonymous namespace, and not reopen IcePy?
As far as I can tell, these functions are local to this file and not declared in the header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
No description provided.