<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to design exceptions classes? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386052#M9404</link>
    <description>&lt;P&gt;This is ind of an open ended question, but i would love to hear your opinion on that subject.&lt;/P&gt;&lt;P&gt;I often see code in the wild where one exception class is defined (say for a package) and every method just throw this exception for a number of different reasons. The different reasons are separated by different text-ids.&lt;/P&gt;&lt;P&gt;For example, if we would formulate the following function in an object-oriented way ...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FUNCTION GUI_DOWNLOAD.
  IMPORTING
    ...
  EXPORTING
    ...
  EXCEPTIONS
    FILE_WRITE_ERROR
    NO_BATCH
    GUI_REFUSE_FILETRANSFER
    INVALID_TYPE
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... we would define an exception class with different textid.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/15846-bildschirmfoto-2017-01-17-um-211016.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is this the way you should define exceptions?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I feel it is very bad idea, because the exception says nothing by itself and you can't see by the signature of the method what are the possible exception situations. I would rather have an exception class for all the 4 reason shown above. What do you think?&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2017 20:21:14 GMT</pubDate>
    <dc:creator>Martin_Bschen</dc:creator>
    <dc:date>2017-01-17T20:21:14Z</dc:date>
    <item>
      <title>How to design exceptions classes?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386052#M9404</link>
      <description>&lt;P&gt;This is ind of an open ended question, but i would love to hear your opinion on that subject.&lt;/P&gt;&lt;P&gt;I often see code in the wild where one exception class is defined (say for a package) and every method just throw this exception for a number of different reasons. The different reasons are separated by different text-ids.&lt;/P&gt;&lt;P&gt;For example, if we would formulate the following function in an object-oriented way ...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FUNCTION GUI_DOWNLOAD.
  IMPORTING
    ...
  EXPORTING
    ...
  EXCEPTIONS
    FILE_WRITE_ERROR
    NO_BATCH
    GUI_REFUSE_FILETRANSFER
    INVALID_TYPE
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... we would define an exception class with different textid.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/15846-bildschirmfoto-2017-01-17-um-211016.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is this the way you should define exceptions?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I feel it is very bad idea, because the exception says nothing by itself and you can't see by the signature of the method what are the possible exception situations. I would rather have an exception class for all the 4 reason shown above. What do you think?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 20:21:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386052#M9404</guid>
      <dc:creator>Martin_Bschen</dc:creator>
      <dc:date>2017-01-17T20:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to design exceptions classes?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386053#M9405</link>
      <description>&lt;P&gt;You might have a look at &lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/abapdocu_751/en/index.htm?file=abenerror_handling_guidl.htm" target="test_blank"&gt;http://help.sap.com/abapdocu_751/en/index.htm?file=abenerror_handling_guidl.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 05:01:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386053#M9405</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-01-18T05:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to design exceptions classes?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386054#M9406</link>
      <description>&lt;P&gt;I have a half written blog about this very topic, this gives me the impetus to finish up... stay tuned!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 13:59:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386054#M9406</guid>
      <dc:creator>raghug</dc:creator>
      <dc:date>2017-01-18T13:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to design exceptions classes?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386055#M9407</link>
      <description>&lt;P&gt;Here you go, I have finally finished the post! The way that I have outlined in the blog, you don't have redeclare every exception; and, it will also handle some exceptions that you are not otherwise aware of.  &lt;A href="https://blogs.sap.com/2017/01/24/handling-old-style-errors-via-class-based-exceptions/"&gt;Handling old-style errors via class based exceptions | SAP Blogs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 23:15:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-design-exceptions-classes/m-p/386055#M9407</guid>
      <dc:creator>raghug</dc:creator>
      <dc:date>2017-01-24T23:15:48Z</dc:date>
    </item>
  </channel>
</rss>

