How pass error message to error box

For example, during encrypt method execution of XPackageEncryption service I get an error. And user should be notified about it. I can throw an css::uno::Exception and then user get errorBox: “Error saving the document ‘***’: Write Error. The file could not be written.” or another predefined error.
But I want user to be provided more verbose error description, where and why it have been occurred, and what user can do next. Is there a mechanism to pass somehow my own description of error up to exception? or may be some workaround?

Actually I can show my own errorBox using XMessageBoxFactory, but then user get 2 error boxes instead of one, while only one box user actually need.

css::uno::Exception has a message and a context. Doesn’t your message in the thrown exception show to the user? If so, I’d suggest you to debug the way from the throw place (which you know) up to the dialog, using a debug build of LibreOffice. Then we might need to change/fix something in the core.

No, it doesn’t.

I’ll try to debug and find out why it doesn’t.