<?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 Re: Is there a way to only return the string in a raised error for a published geoprocessing service? in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1601351#M4968</link>
    <description>&lt;P&gt;Thank you for that traceback information! After testing, the&amp;nbsp;&lt;SPAN&gt;arcpy. AddError('message') then exit() returns only the 'message' string as expected. However, there are always at least 5 messages returned if the job fails.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;UL&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeInformative&lt;/I&gt;: Submitted.&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeInformative&lt;/I&gt;: Executing...&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: &lt;SPAN&gt;Shapefile is not a polygon. Input must be a polygon with a non empty feature&lt;/SPAN&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: Failed to execute (***tool name***).&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: Failed.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Is there any documentation that defines the number of &lt;I&gt;esriJobMessageTypeInformative&lt;/I&gt; and orv&lt;I&gt;esriJobMessageTypeError&amp;nbsp;&lt;/I&gt;that will be returned from the server by default? I have the message level set to 'error', yet those first two informative entries always appear. Additionally, there are always two error messages at the end informing me the tool has failed. It would be great to have some ESRI documentation to send to the web team so they know the error message will be consistent.&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 01 Apr 2025 15:56:20 GMT</pubDate>
    <dc:creator>MBocek</dc:creator>
    <dc:date>2025-04-01T15:56:20Z</dc:date>
    <item>
      <title>Is there a way to only return the string in a raised error for a published geoprocessing service?</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1600436#M4966</link>
      <description>&lt;P&gt;I have a python geoprocessing toolbox that was published from Pro 2.9.5 to a 10.9.1 Enterprise server. I would like to display the error messages from the tool to a web UI, but I cannot find a way to only return the string in the raise error. For example, with the message level set to 'error', the tool always returns 5 messages&lt;/P&gt;&lt;DIV class=""&gt;&lt;UL&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeInformative&lt;/I&gt;: Submitted.&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeInformative&lt;/I&gt;: Executing...&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: Traceback (most recent call last): File "&amp;lt;string&amp;gt;", ***path removed ***&amp;nbsp; raise arcpy.ExecuteError('Shapefile is not a polygon. Input must be a polygon with a non empty feature.') arcgisscripting.ExecuteError: Shapefile is not a polygon. Input must be a polygon with a non empty feature.&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: Failed to execute (***tool name***).&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: Failed.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This is the code creating the error:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt; &lt;SPAN&gt;geom&lt;/SPAN&gt;&lt;SPAN&gt;.type &lt;/SPAN&gt;&lt;SPAN&gt;!=&lt;/SPAN&gt; &lt;SPAN&gt;'polygon'&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;raise&lt;/SPAN&gt; &lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;SPAN&gt;.ExecuteError(&lt;/SPAN&gt;&lt;SPAN&gt;'Shapefile is not a polygon. Input must be a polygon with a non empty feature.'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I see an alternative would be to use arcpy.AddError, then exit() after. However, I still see an issue with additional error/informative messages being passed. Essentially, is there a way to only return the following?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;:&amp;nbsp;&lt;SPAN&gt;'Shapefile is not a polygon. Input must be a polygon with a non empty feature.'&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Mar 2025 15:28:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1600436#M4966</guid>
      <dc:creator>MBocek</dc:creator>
      <dc:date>2025-03-28T15:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to only return the string in a raised error for a published geoprocessing service?</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1600479#M4967</link>
      <description>&lt;P&gt;How uncaught exceptions are handled is at the discretion of whatever's running Python, which in this case is the Web Tool infrastructure, so you're limited in how you can format your errors. A long shot might be the &lt;FONT face="courier new,courier"&gt;sys.tracebacklimit&lt;/FONT&gt; global, &lt;A href="https://stackoverflow.com/a/21556806" target="_self"&gt;this SO post&lt;/A&gt; implies it might be able to cut down on what ArcGIS can report on.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 16:44:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1600479#M4967</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-03-28T16:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to only return the string in a raised error for a published geoprocessing service?</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1601351#M4968</link>
      <description>&lt;P&gt;Thank you for that traceback information! After testing, the&amp;nbsp;&lt;SPAN&gt;arcpy. AddError('message') then exit() returns only the 'message' string as expected. However, there are always at least 5 messages returned if the job fails.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;UL&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeInformative&lt;/I&gt;: Submitted.&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeInformative&lt;/I&gt;: Executing...&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: &lt;SPAN&gt;Shapefile is not a polygon. Input must be a polygon with a non empty feature&lt;/SPAN&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: Failed to execute (***tool name***).&lt;/LI&gt;&lt;LI&gt;&lt;I&gt;esriJobMessageTypeError&lt;/I&gt;: Failed.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Is there any documentation that defines the number of &lt;I&gt;esriJobMessageTypeInformative&lt;/I&gt; and orv&lt;I&gt;esriJobMessageTypeError&amp;nbsp;&lt;/I&gt;that will be returned from the server by default? I have the message level set to 'error', yet those first two informative entries always appear. Additionally, there are always two error messages at the end informing me the tool has failed. It would be great to have some ESRI documentation to send to the web team so they know the error message will be consistent.&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Apr 2025 15:56:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1601351#M4968</guid>
      <dc:creator>MBocek</dc:creator>
      <dc:date>2025-04-01T15:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to only return the string in a raised error for a published geoprocessing service?</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1601369#M4969</link>
      <description>&lt;P&gt;Those starting and ending messages are consistent with what appears in my environment. The message level appears to ignore those 2 leading messages and you always get 2 ending errors so I think you've hit the limit. Luckily the only internal info being leaked is the tool name so if you're able to instruct your users to ignore the other messages then you're good.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 16:16:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/is-there-a-way-to-only-return-the-string-in-a/m-p/1601369#M4969</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-04-01T16:16:09Z</dc:date>
    </item>
  </channel>
</rss>

