Bug 42982 - Improve UNO API error reporting
Summary: Improve UNO API error reporting
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Master old -3.6
Hardware: Other All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:5.4.0 target:6.0.0 target:6.2....
Keywords: difficultyBeginner, easyHack, skillCpp, topicDebug
Depends on:
Blocks: UNO Dev-related
  Show dependency treegraph
 
Reported: 2011-11-16 03:04 UTC by Michael Stahl (allotropia)
Modified: 2024-10-29 12:45 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Patch to fix namecont.cxx (1012 bytes, patch)
2012-04-11 12:08 UTC, Abeer Sethi
Details
This includes the suggested changes for namecont.cxx (1.02 KB, patch)
2012-04-12 05:39 UTC, Abeer Sethi
Details
A patch for copytablewizard.cxx (2.11 KB, patch)
2012-04-12 05:40 UTC, Abeer Sethi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Stahl (allotropia) 2011-11-16 03:04:28 UTC
There are many implementations of UNO APIs in LibreOffice,
and a lot of them have only very primitive error reporting.

In many cases the only form of error reporting used is
"throw RuntimeException;", which is completely unhelpful
to API users such as extension developers.

Such exceptions should be improved:

1. most importantly, an error message should be included in
   the exception so the API user may get some idea what
   is going wrong.
   for this, the newly introduced printf-style OSL_FORMAT
   macro may be useful.
   
2. in some cases a more specific exception than RuntimeException
   can be thrown.
   but beware that only the exceptions that are listed in the
   exception specification of the UNO API method may be thrown;
   subtypes of RuntimeException are always allowed, but there
   are surprising exceptions (IIRC IllegalArgumentException is
   one) that are not subtypes of RuntimeException.

the offending exceptions can easily be found with "git grep".
Comment 1 Abeer Sethi 2012-03-18 14:13:42 UTC
Can you tell me from my git-diff whether I'm on the right track?


http://pastebin.com/raw.php?i=XAR4s81e
Comment 2 Stephan Bergmann 2012-03-19 03:45:37 UTC
Re comment 1:

1  Lines are cut from the output in <http://pastebin.com/raw.php?i=XAR4s81e>.  (And better attach a patch to this issue than going via pastebin, anyway.)

2  For simple string messages like

  throw RuntimeException(OSL_FORMAT("XListener is not equal to 1"));

there is no need to go via OSL_FORMAT.  The standard idiom to create an rtl::OUString instance from an (ASCII) string literal for now is

  rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("XListener is not equal to 1"))

3  RuntimeException constructors either take no arguments or two arguments (Message, a string; and Context, a com::sun::star::uno::XInterface reference to the relevant UNO object or a null reference).

So, in basic/source/uno/namecont.cxx you would need a second argument

  static_cast< cppu::OWeakObject * >(this)

(where the cast is necessary as this derives from XInterface multiple times), and in the later files you would need to move your new, third argument to be the first one instead, replacing the empty "rtl::OUString()"
Comment 3 Abeer Sethi 2012-04-11 12:08:43 UTC
Created attachment 59811 [details]
Patch to fix namecont.cxx
Comment 4 Stephan Bergmann 2012-04-12 00:45:56 UTC
(In reply to comment #3)
> Created attachment 59811 [details] [review]
> Patch to fix namecont.cxx

See <http://lists.freedesktop.org/archives/libreoffice/2012-April/029894.html> for a comment about that patch.  (In general, it is better to present a patch for review in one place only, either in a bug or on the mailing list.)
Comment 5 Abeer Sethi 2012-04-12 05:39:44 UTC
Created attachment 59853 [details]
This includes the suggested changes for namecont.cxx
Comment 6 Abeer Sethi 2012-04-12 05:40:45 UTC
Created attachment 59855 [details]
A patch for copytablewizard.cxx
Comment 7 Stephan Bergmann 2012-04-23 12:13:21 UTC
(In reply to comment #5)
> Created attachment 59853 [details] [review]
> This includes the suggested changes for namecont.cxx

pushed as <http://cgit.freedesktop.org/libreoffice/core/commit/?id=c9afb3f5a7f713d34f70b680c5d4ab3db4044d1c>
Comment 8 Stephan Bergmann 2012-04-23 12:14:43 UTC
(In reply to comment #6)
> Created attachment 59855 [details] [review]
> A patch for copytablewizard.cxx

pushed as <http://cgit.freedesktop.org/libreoffice/core/commit/?id=67d022ac0ce5e67565e0589f4cd9eb05a8fd5a3c>
Comment 9 Florian Reisinger 2012-05-18 09:33:34 UTC
Deleted "Easyhack" from summary.
Comment 10 Michael Stahl (allotropia) 2012-06-29 14:10:36 UTC
Comment on attachment 59855 [details]
A patch for copytablewizard.cxx

i'll mark this as "obsolete" since it was integrated,
so that it doesn't show up in bugzilla searches
Comment 11 Björn Michaelsen 2013-10-04 18:48:12 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 12 Cédric Bosdonnat 2014-01-20 09:00:36 UTC Comment hidden (noise)
Comment 13 How can I remove my account? 2015-04-14 08:13:15 UTC
Abeer, if you continue doing these patches (please do!), just a minor nit: Please avoid exclamation marks in the exception messages. (Just my personal taste...)
Comment 14 Robinson Tryon (qubit) 2015-12-13 10:58:07 UTC Comment hidden (obsolete)
Comment 15 Robinson Tryon (qubit) 2016-02-18 14:52:39 UTC Comment hidden (obsolete)
Comment 16 Sudarshan K 2016-10-12 17:05:51 UTC
I would like to take a stab at this (I'm assuming this is an EasyHack). Can someone tell me what to do here, Which module to look at and which files to make the changes in ? I'm new. Thanks.
Comment 17 Sudarshan K 2016-10-12 17:10:48 UTC
Can someone please assign this bug to me. Also whom should I contact here or on the IRC channel regarding this bug (#libreoffice-dev) .
Comment 18 jani 2016-10-12 17:23:04 UTC
(In reply to Sudarshan K from comment #17)
> Can someone please assign this bug to me. Also whom should I contact here or
> on the IRC channel regarding this bug (#libreoffice-dev) .

just assign it yourself. I am here to help,


source is in eg basic/uno (see comments)

it is good if you have a little experience with uno.


also please see
https://wiki.documentfoundation.org/Development/GetInvolved
Comment 19 Sudarshan K 2016-10-13 04:51:53 UTC
(In reply to jan iversen from comment #18)
> (In reply to Sudarshan K from comment #17)
> > Can someone please assign this bug to me. Also whom should I contact here or
> > on the IRC channel regarding this bug (#libreoffice-dev) .
> 
> just assign it yourself. I am here to help,
> 
> 
> source is in eg basic/uno (see comments)
> 
> it is good if you have a little experience with uno.
> 
> 
> also please see
> https://wiki.documentfoundation.org/Development/GetInvolved

Hey jan,
I have been looking into /basic/source/uno and here is what my understanding is -
I see a lot of errors being thrown (just a simple RuntimeException(), I did a grep for RuntimeException()) without them being descriptive. So I need to make them throw the error with bit more details, the way Abeer Sethi has done.
Am I correct in this ?
Also, you said a little experience with uno would be required, could you direct me to the relevant docs ( This is my first attempt at contributing to LibOffice, so I have no experience with uno).
Thanks.
Comment 20 jani 2016-10-13 06:42:21 UTC
Change to assigned

You are correct in your assumption, find the RunTimeException and add description, that is basically the task.

Go to our wiki.documentfoundation.org and search for UNO, but as you have already found the right way in the source you will not really need that.

Happy hacking
Comment 21 Sudarshan K 2016-10-13 13:26:30 UTC
jan iversen: This is the link for the patch - https://gerrit.libreoffice.org/#/c/29771/

I forgot to include this in the commit. I will remember that next time.
Comment 22 jani 2016-11-14 10:15:48 UTC Comment hidden (obsolete)
Comment 23 jani 2016-12-21 08:56:28 UTC
Unassing due to lack of work
Comment 24 Saurav S 2017-01-17 16:52:07 UTC
Hello. I'm a new contributor. I'd like to take a stab at this and make every plain RuntimeException in /basic/source/uno/* more descriptive.
Comment 25 Saurav S 2017-01-17 17:02:12 UTC
jan iversen: I've submitted a patch https://gerrit.libreoffice.org/#/c/33227/
Comment 26 jani 2017-01-17 18:37:00 UTC
(In reply to Saurav S from comment #25)
> jan iversen: I've submitted a patch https://gerrit.libreoffice.org/#/c/33227/

Welcome, I see Bergmann have already looked at your patch, when you correct it, please remember to use "git commit --amend" so you update the patch instead of making a new one.

Apart from that, welcome, we have made a step-by-step guide for new people:
https://wiki.documentfoundation.org/Development/GetInvolved

Most importantly is to mail your license statement:
https://wiki.documentfoundation.org/Development/Developers#Example_Code_Contributor_Statement

have fun.
jan I
Comment 27 Saurav S 2017-01-19 17:28:59 UTC
Hello jan, I've submitted a second patch set taking into account Bergmann's comments, and I've sent my license statement to libreoffice@lists.freedesktop.org like the wiki suggested.
Comment 28 Saurav S 2017-01-19 17:40:03 UTC
Oops, I'd left out a couple of changes from patch set 2. I've submitted one with all the updates. Sorry for the inconvenience!
Comment 29 Commit Notification 2017-02-13 20:29:16 UTC
Saurav Sachidanand committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2bcefa7aab176bf18b45e7038e91dd07ced6edf7

tdf#42982 Make UNO error reporting more descriptive

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 30 Aleksas Pantechovskis 2017-02-28 13:00:26 UTC
(In reply to Michael Stahl from comment #0)
>    subtypes of RuntimeException are always allowed, but there
>    are surprising exceptions (IIRC IllegalArgumentException is
>    one) that are not subtypes of RuntimeException.

http://gimli.documentfoundation.org/docs/idl/ref/exceptioncom_1_1sun_1_1star_1_1uno_1_1RuntimeException.html says that IllegalArgumentException is RuntimeException.
Comment 31 Stephan Bergmann 2017-02-28 14:29:37 UTC
(In reply to Aleksas Pantechovskis from comment #30)
> http://gimli.documentfoundation.org/docs/idl/ref/
> exceptioncom_1_1sun_1_1star_1_1uno_1_1RuntimeException.html says that
> IllegalArgumentException is RuntimeException.

...but only since <https://cgit.freedesktop.org/libreoffice/core/commit/?id=31170413ae3786bf44564e813d7291354e939a77> "API CHANGE: com.sun.star.lang.IllegalArgumentException"
Comment 32 Aleksas Pantechovskis 2017-02-28 17:36:25 UTC
Also looks like OSL_FORMAT was replaced by SAL_STREAM http://nabble.documentfoundation.org/Assertions-and-Logging-td3518719.html but git grep found only 2 usages of it.
As far as I can see currently string concatenation via + operator is usually used ("cannot get service instance \"" + rServiceName + "\"!").
Comment 33 Stephan Bergmann 2017-03-01 07:38:53 UTC
(In reply to Aleksas Pantechovskis from comment #32)
> Also looks like OSL_FORMAT was replaced by SAL_STREAM
> http://nabble.documentfoundation.org/Assertions-and-Logging-td3518719.html
> but git grep found only 2 usages of it.
> As far as I can see currently string concatenation via + operator is usually
> used ("cannot get service instance \"" + rServiceName + "\"!").

Yeah, comment 0 is a bit dated by now.  :)  SAL_STREAM should be rarely necessary, if at all (the two uses in sfx2/source/control/bindings.cxx could arguably be rewritten using string concatenation with + instead), and should never be necessary when generating useful exception messages in the context of this issue.  Always use string concatenation for that (use OUString::number to put numbers into the message).
Comment 34 Commit Notification 2017-03-03 20:51:08 UTC
Alex P committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7e8806cd728bf906e1a8f1d649bef7337f297b1c

tdf#42982 improve error reporting in sc unoobj

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 35 Shinnok 2017-08-28 12:17:05 UTC
Michael or Stephan, can you briefly verify that the two associated patches merged already completely resolve this issue?

https://gerrit.libreoffice.org/34762
https://gerrit.libreoffice.org/33227
Comment 36 Michael Stahl (allotropia) 2017-08-28 12:25:59 UTC
i can briefly confirm that the patches from comment #35 have resolved at most 3% of the issue. 

git grep "throw .*RuntimeException *( *)" | wc -l
1582
Comment 37 Commit Notification 2017-09-07 18:51:17 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4b56d76e83fe062e39f5c00fa405f2a14a13b7ca

tdf#42982 Improve exceptions in text document api

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 38 Commit Notification 2018-10-27 21:15:04 UTC
Izabela Bakollari committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0f190f50368816964b2a1b7bb58000ac1792d640

tdf#42982: added description on RuntimeException

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 39 Commit Notification 2020-02-19 11:32:23 UTC
nienzu committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d8fe52d759ba033bd661893f12d17576d24276db

tdf#42982 add detail exception reason for UnoControls

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 40 Commit Notification 2020-02-20 09:43:20 UTC
Burak Bala committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7aaa3109edfc2e1fadc533d4d276ee7c14b80dea

tdf#42982 Make UNO error reporting more descriptive

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 41 Commit Notification 2020-02-20 10:01:47 UTC
Faruk Demirbaş committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/eee035a7c0d8923134d0e3a8520d13706ce9bf9f

tdf#42982: Improve UNO API error reporting

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 42 Commit Notification 2020-02-24 09:24:54 UTC
Mesut Çifci committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4f1e3dd278d6c65b8b1b198562d1649bad79622b

tdf#42982: improve UNO API error reportings

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 43 Commit Notification 2020-02-27 10:05:47 UTC
AlanTang committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/da7617641b5d955610ae25bda65fa10c4ca1b7c3

tdf#42982 added description on RuntimeException for unotools

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 44 Commit Notification 2020-04-21 05:53:15 UTC
Ian Barkley-Yeung committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b762eaba776abde3173a39df3133d1d1b40ccd44

tdf#42982: Improve UNO API error reporting

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 45 Commit Notification 2020-04-27 07:42:13 UTC
Ian Barkley-Yeung committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/27306e0eeee8a22e554f6f5bebccca4f778ae731

tdf#42982: Improve UNO API error reporting

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 46 Homeboy_445 2020-12-28 13:34:44 UTC
Please review the changes made by me: https://gerrit.libreoffice.org/c/core/+/108356/2
Comment 47 Homeboy_445 2021-01-06 15:18:09 UTC
Please review the recent changes made:https://gerrit.libreoffice.org/c/core/+/108356/2
Comment 48 Commit Notification 2021-01-07 15:04:20 UTC
homeboy445 committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7bd5c31472804624d740d8c831d3b043f2d3a0be

tdf#42982 Improved UNO API error reporting

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 49 Commit Notification 2021-01-12 18:25:33 UTC
Bayram Çiçek committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/32676270d194b68d7dd811511feb0903876b5c06

tdf#42982: Improve UNO API error reporting

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 50 Commit Notification 2021-01-20 11:03:47 UTC
Tarun Sharma committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3ff95c8df6be9aa01aef5c663ee2ffa9881193d4

tdf#42982: Improve UNO API error reporting

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 51 adityapratapsingh51 2021-01-31 17:16:14 UTC
I am new to the LibreOffice community. Can I start working on this bug?
Comment 52 Buovjaga 2021-01-31 17:29:34 UTC
(In reply to adityapratapsingh51 from comment #51)
> I am new to the LibreOffice community. Can I start working on this bug?

You sure can
Comment 53 adityapratapsingh51 2021-02-01 16:36:14 UTC
Please review the recent changes made by me https://gerrit.libreoffice.org/c/core/+/110261
Comment 54 Vipul 2021-02-10 17:51:45 UTC
I am thinking of passing a message in ElementExistException(). Should I pass the message(string) only or there is also I need to pass two arguments?
Comment 55 Vipul 2021-02-10 18:43:38 UTC
(In reply to Vipul from comment #54)
> I am thinking of passing a message in NoSuchElementException(). Should I pass
> the message(string) only or there is also I need to pass two arguments?
Comment 56 Vipul 2021-02-10 18:44:03 UTC Comment hidden (obsolete)
Comment 57 adityapratapsingh51 2021-02-11 02:54:38 UTC
(In reply to adityapratapsingh51 from comment #53)
> Please review the recent changes made by me
> https://gerrit.libreoffice.org/c/core/+/110261

Someone please review this patch
Comment 58 Commit Notification 2021-02-12 13:02:25 UTC
Aditya Pratap Singh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8ad6257d456c595a47669846fc3ef5337653bd03

tdf#42982 Add descriptions to some runtime exceptions

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 59 Commit Notification 2021-02-17 12:25:02 UTC
vipbuoy committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1775cd844bc5b45e1f40148051ad9cc2635413e0

tdf#42982 updated RunTimeException with 2nd argument(pointer)

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 60 Commit Notification 2021-03-08 10:09:12 UTC
ViKrAm-Bais committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/394ad7fa73ec70e576a4b0bdfaa7cc2986e1bf46

tdf#42982: improve UNO API error reporting

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 61 Padia Rashesh 2021-06-16 15:57:17 UTC
I checked all the runtime exception are descriptive now , then why this issue is still open?
Comment 62 Buovjaga 2021-06-16 16:02:24 UTC
(In reply to Padia Rashesh from comment #61)
> I checked all the runtime exception are descriptive now , then why this
> issue is still open?

According to

git grep "throw .*RuntimeException *( *)" | wc -l

there are still 1465 places to change, so I wonder how you checked?
Comment 63 Commit Notification 2021-09-01 08:51:03 UTC
Olivier Hallot committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/75fca5341ec1e4d0a0113fce26df9992d7352591

tdf#42982 RuntimeException msg for SwXFrame::setName()

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 64 Commit Notification 2021-09-14 09:16:44 UTC
4k5h1t committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5f4a84ce5b775eb017bd784db95857684b7e90ed

tdf#42982: improve UNO API error reporting

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 65 Commit Notification 2021-10-04 09:22:42 UTC
Verne-Lai committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/dad5b69b229047e0bba921f185dddd6ce26183a5

[tdf#42982]Improve runtimeException's Message

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 66 Commit Notification 2021-10-24 14:46:39 UTC
4k5h1t committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0776e75fbc09201052e27a33cbc9e8f117b43596

tdf#42982: improve UNO API error reporting

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 67 Commit Notification 2022-03-07 20:20:18 UTC
Deep17 committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1fb1f0be10b5d6ce3be5bb364b4c9a8eb0d31b54

tdf#42982: improve UNO API error reporting

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 68 Commit Notification 2022-04-18 06:43:23 UTC
Siddhant Chaudhary committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/370077502210f4d41a1d2014c3e3f99536217ce7

tdf#42982 Improved UNO API error reporting.

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 69 Hossein 2022-06-21 14:07:30 UTC
Re-evaluating the EasyHack in 2022

This issue is still relevant, as there are many places in the code that should be changes.

$ git grep "throw .*RuntimeException *( *)" | wc -l
1487
Comment 70 Commit Notification 2022-09-15 13:11:42 UTC
Mahdi Tizabi committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/cab4fd84ff9f59027d4de5a0bb96d50b7b07df13

tdf#42982 Improved UNO API error reporting

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 71 Commit Notification 2022-09-15 13:21:57 UTC
PoonamShokeen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d29958304b3ff87115ed5af16b482327ea05ce14

tdf#42982 improve UNO API error reporting

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 72 Commit Notification 2022-10-18 19:25:31 UTC
Calvince Otieno committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/71aaa2eaa25f1a6bc958c5dcffa79b478ddfa664

tdf#42982 Make UNO error reporting more descriptive

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 73 Commit Notification 2023-03-23 06:34:11 UTC
Jani Saranpää committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6dfa9c7c0db91a71f3787226636864161d5367ca

tdf#42982 Improve UNO API error reporting

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 74 Commit Notification 2023-10-13 18:01:22 UTC
Ankit_Jaipuriar committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a97ceaf14e294373b864c61c930f8723e13747c7

tdf#42982 Improved UNO API error reporting

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 75 Commit Notification 2023-10-19 11:14:29 UTC
khushishikhu committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/baf677e2f1130205df6e4a5cf0a94f4d9dc228a5

tdf#42982: Improve UNO API error reporting

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 76 Hossein 2023-10-31 14:20:58 UTC
Re-evaluating the EasyHack in 2023

This issue is still relevant. There are still many instances of the UNO API error reports that need improvement:

Number of instances to be changed:
$ git grep "throw .*RuntimeException *( *)" *.cxx| wc -l
1418

Number of C++ files to be changed:
$ git grep -l "throw .*RuntimeException *( *)" *.cxx|wc -l
316

One can refer to this blog post for a detailed description of the task:

UNO API error reporting improvement – EasyHack
https://dev.blog.documentfoundation.org/2023/10/26/uno-api-error-reporting-improvement-easyhack/
Comment 77 Vivek Kumar 2024-02-15 10:53:13 UTC
I am starting to work on this bug. This is my first easy hack attempt.
Comment 78 Vivek Kumar 2024-02-15 11:23:07 UTC
Can please somebody give me steps on how to solve a bug here, I tried reading above comments but didn't understand anything.
Comment 79 Buovjaga 2024-02-15 18:31:32 UTC
(In reply to Vivek Kumar from comment #78)
> Can please somebody give me steps on how to solve a bug here, I tried
> reading above comments but didn't understand anything.

There is no bug to solve here. This is about making the API development experience better.

In addition to reading comments, also read commits.

If you want to receive our standard mentoring, email me.
Comment 80 Commit Notification 2024-02-16 09:52:27 UTC
seturaj committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b508e4f0813b62c3e5d10a2fbacec1fb8839ece4

tdf#42982: Improve UNO error reporting. Make exceptions more descriptive

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 81 Commit Notification 2024-02-27 22:31:10 UTC
AhmedHamed committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/487ce28057656e752dc9bb7eddea5befb446ad0a

tdf#42982 Improve UNO API error reporting

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 82 Commit Notification 2024-03-10 22:40:36 UTC
varshneydevansh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/cc695e180b39ffe21f0ae12cfeefb89a50a50b64

tdf#42982: Improve UNO API error reporting

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 83 Commit Notification 2024-03-30 12:32:35 UTC
RMZeroFour committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/599b113b732190749385293a9fbc8ffc3e618556

tdf#42982 Add error messages to thrown exceptions

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 84 Commit Notification 2024-04-09 07:07:18 UTC
Mohit Marathe committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e211607dffe2986601359dcb1ef757fda3805fb3

tdf#42982: Improve UNO API error reporting

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 85 Hakim Ottey 2024-04-24 13:55:45 UTC
I am going to start working on this easy hack
Comment 86 Buovjaga 2024-04-24 14:05:11 UTC
Multi-hack, so never assigned.
Comment 87 Commit Notification 2024-07-02 07:47:16 UTC
HakimOttey committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7153b25d4da845bfb309c75df48f9ea00ec70c47

tdf#42982 Use IllegalTypeException Error with message

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 88 Mike Kaganski 2024-07-02 08:19:56 UTC
(In reply to Commit Notification from comment #87)
> tdf#42982 Use IllegalTypeException Error with message

Looking at commit 7153b25d4da845bfb309c75df48f9ea00ec70c47, I have a feeling that only by accident, it didn't break the API guarantees. So let me clarify an important consideration that any easyhacker here must keep in mind. I do it using the said commit as an example.

The commit changed EnumerableMap::impl_initValues_throw. The function used to throw RuntimeException [1], and now it throws IllegalTypeException [2].

The function is used in EnumerableMap::initialize, which (as it is obvious from the EnumerableMap class definition) is an implementation of the XInitialization method [3]. It is important to realize, that the method is part of the published API, including its exceptions guarantee. So this change must make sure to check, that it doesn't break the API.

In this case, the documentation specifies that the method throws Exception, which is luckily the ancestor of both RuntimeException and IllegalTypeException (so it is not an API break). But please make sure, that every commit that changes a thrown exception type, is careful to explain this in the commit message, and document there, which APIs the change affects, and that the change doesn't break those APIs' guarantees.

[1] https://api.libreoffice.org/docs/idl/ref/exceptioncom_1_1sun_1_1star_1_1uno_1_1RuntimeException.html
[2] https://api.libreoffice.org/docs/idl/ref/exceptioncom_1_1sun_1_1star_1_1beans_1_1IllegalTypeException.html
[3] https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1lang_1_1XInitialization.html#a4c324e2c089ac21cc486cdf1e611e03e
Comment 89 Commit Notification 2024-07-02 10:24:14 UTC
Beeram_12 committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/458f5a7e8c2cd2e38eb744f6046f27874f0a0fa0

tdf#42982 Improve UNO API error reporting

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 90 Commit Notification 2024-08-14 05:54:15 UTC
HakimOttey committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6aa87b23c445b42690a2461817b7ad24f6c31ec9

Related: tdf#42982 replace IllegalTypeException with RuntimeException

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 91 Commit Notification 2024-09-25 07:29:55 UTC
Ashok committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/dbccdea9744c5400a5dad908bce5d2973ac60f3c

tdf#42982 Improve Error Messages with RuntimeException in UNO API

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 92 Commit Notification 2024-10-29 12:45:36 UTC
Oromidayo Owolabi committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ca1f1962ae163345ecaedc288244448589ae2a0e

tdf#42982 Improve UNO API error reporting

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.