Niklas Nebel wrote:
On 04/18/09 17:51, Jan Holst Jensen wrote:
1) Is there a way that I can provide additional error information to be shown in the status bar ? [The best option] 2) Should I fall back to defining all return types as "any" and then return error message strings in case of errors ? [Ugly, but should work] 3) Is there a trick to doing this better, e.g. raise a particular kind of exception ? [Perhaps even better]

You can use IllegalArgumentException to get "Err:502" (Invalid Argument) instead, but you can't provide your own error message.

Thanks. That is after all slightly better than the current situation. A pity though that I cannot provide additional error info in the status bar...
If you return the error message as a string, it depends on your usage of the function if it is handled correctly.
Yes. It is probably more sensible to just use IllegalArgumentException.

However, I wonder if I could then let the add-in provide a menu item that says "Check formula in current cell"... If there is a straightforward way that I can ask OOo Calc to evaluate a given cell formula I should then be able to wrap the evaluation in a try...catch block, catch the exception and then display that error message to the user. I'll try to pursue this idea, unless someone can persuade me that it is impossible.

Kind regards
-- Jan Holst Jensen

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to