Martin Thoma wrote:
Hello!

I have some problems concerning exceptions in C++. For example take this
code, which just stores a document. If the file already exists or the
writing fails, because we want to write on a removable disk which is not
inserted, the catch-block is executed, which is correct.

But e.Message is always empty (e.message.getLength() is always 0). I have
longer api-codes packed in a try-catch-block, and I don't get any messages
at all when a catch is triggered.

Any idea what could be the problem?

That is most probably due to the code that throws the exception not setting any message in the first place. (Even if, unfortunately, no message is set in a given case, you might get more information by inspecting what subclass of com::sun::star::uno::Exception is actually thrown, by either using C++ RTTI or cppu::getCaughtException from cppuhelper/exc_hlp.hxx.)

-Stephan

// ToStr converts a CString to a OUString
Reference <XStorable> rStore (rDocument, UNO_QUERY);
Sequence < PropertyValue > pvSave(2);
pvSave[0].Name = ToStr("Overwrite");
pvSave[0].Value = makeAny(sal_Bool(FALSE));
pvSave[1].Name = ToStr("FilterName");
pvSave[1].Value = makeAny(ToStr(sFilter));
try
{       rStore->storeToURL(ToStr("file:///"+sFilename), pvSave);
}
catch(com::sun::star::uno::Exception &e)
{       // e.Message is always empty
}

Regards

Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to