<?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 Some more useful error handling for broken services please. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/some-more-useful-error-handling-for-broken/m-p/560598#M52317</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I ran into this problem with (version 3.9) esri/arcgis/utils#createMap where my defined basemap layer is down, so the map creation errors out completely and breaks my app.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
arcgisUtils.createMap(webmapJSON, elementId, options).then(onSuccess, onError);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I can do is use the error function to add a different basemapLayer url (like the Esri World Imagery), but there are a few issues here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="font-style:italic;"&gt;Error seems to delete basemap object from basemapLayers array&lt;/SPAN&gt;: This means I have to add a new object instead of just change the URL. It would be cool if you didn't mutate my objects.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="font-style:italic;"&gt;Error only tells me a URL is not valid&lt;/SPAN&gt;: This could mean it's a basemapLayer or maybe an operationalLayer (map fails to create with a bad op layer URL too, checked), I'm not sure how to tell. This makes error handling these kind of things more difficult.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="font-style:italic;"&gt;Map creation doesn't need to be halted because of a bad URL&lt;/SPAN&gt;: A map can exist without a basemap, maybe add the errors to the response callback to check for any errors that occured during the map creation process.&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;In this case, I can tell after the fact that the basemapLayer is dead, but this doesn't help me in production to handle these errors if I can't tell what has gone wrong. The Error codes do contain an empty details array, so maybe the JS API internals could populate that with some more useful information.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although I like the idea of not breaking map creation because of a bad URL to begin with. It's much easier to handle a missing layer inside the application than it is to decipher what went wrong in the map creation process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;*edit* -&lt;/SPAN&gt;&lt;SPAN&gt; I just double-checked. The response object from the createMap promise does have an errors array. Can you just put any map creation errors there, including invalid URL errors? I suppose I'm confused why a broken basemap/operational URL will halt the map creation process.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 May 2014 16:09:24 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2014-05-29T16:09:24Z</dc:date>
    <item>
      <title>Some more useful error handling for broken services please.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/some-more-useful-error-handling-for-broken/m-p/560598#M52317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I ran into this problem with (version 3.9) esri/arcgis/utils#createMap where my defined basemap layer is down, so the map creation errors out completely and breaks my app.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
arcgisUtils.createMap(webmapJSON, elementId, options).then(onSuccess, onError);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I can do is use the error function to add a different basemapLayer url (like the Esri World Imagery), but there are a few issues here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="font-style:italic;"&gt;Error seems to delete basemap object from basemapLayers array&lt;/SPAN&gt;: This means I have to add a new object instead of just change the URL. It would be cool if you didn't mutate my objects.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="font-style:italic;"&gt;Error only tells me a URL is not valid&lt;/SPAN&gt;: This could mean it's a basemapLayer or maybe an operationalLayer (map fails to create with a bad op layer URL too, checked), I'm not sure how to tell. This makes error handling these kind of things more difficult.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="font-style:italic;"&gt;Map creation doesn't need to be halted because of a bad URL&lt;/SPAN&gt;: A map can exist without a basemap, maybe add the errors to the response callback to check for any errors that occured during the map creation process.&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;In this case, I can tell after the fact that the basemapLayer is dead, but this doesn't help me in production to handle these errors if I can't tell what has gone wrong. The Error codes do contain an empty details array, so maybe the JS API internals could populate that with some more useful information.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although I like the idea of not breaking map creation because of a bad URL to begin with. It's much easier to handle a missing layer inside the application than it is to decipher what went wrong in the map creation process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;*edit* -&lt;/SPAN&gt;&lt;SPAN&gt; I just double-checked. The response object from the createMap promise does have an errors array. Can you just put any map creation errors there, including invalid URL errors? I suppose I'm confused why a broken basemap/operational URL will halt the map creation process.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 16:09:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/some-more-useful-error-handling-for-broken/m-p/560598#M52317</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2014-05-29T16:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Some more useful error handling for broken services please.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/some-more-useful-error-handling-for-broken/m-p/560599#M52318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree.&amp;nbsp; I'm frustrated that I can catch the error and load a backup base map, but I can't keep the original error from propagating, causing the map loading process to halt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to set up a &lt;STRONG&gt;failover&lt;/STRONG&gt; process for the base map so that my users will see some type of map underneath my data, instead of just a blank background.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2014 20:29:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/some-more-useful-error-handling-for-broken/m-p/560599#M52318</guid>
      <dc:creator>JamesKimrey</dc:creator>
      <dc:date>2014-10-29T20:29:50Z</dc:date>
    </item>
  </channel>
</rss>

