<?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: How to catch a layer failing to load within a webmap (JS API + Experience Builder) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-catch-a-layer-failing-to-load-within-a/m-p/1208430#M78530</link>
    <description>&lt;P&gt;You can use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#event-layerview-create-error" target="_self"&gt;layerview-create-error&lt;/A&gt; event to notify the user that something didn't load properly.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.on("layerview-create-error", function(event) {
  console.error("LayerView failed to create for layer with the id: ", event.layer.id);
});&lt;/LI-CODE&gt;&lt;P&gt;This error will fire for each layer that doesn't load properly&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2022 20:23:52 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2022-08-31T20:23:52Z</dc:date>
    <item>
      <title>How to catch a layer failing to load within a webmap (JS API + Experience Builder)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-catch-a-layer-failing-to-load-within-a/m-p/1208388#M78529</link>
      <description>&lt;P&gt;Hello! We're building an application using Experience Builder 1.7 and JS API 4.24.&lt;/P&gt;&lt;P&gt;The application has a WebMap, and currently if a layer within that map fails to load the app silently continues and there is no indication to the end user that something went wrong during load and the layer is simply excluded form the layer list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to catch this event in code so I can properly handle this, and tell the user which layer(s) failed to load so they are aware the data won't be present.&lt;/P&gt;&lt;P&gt;I've tried adding a catch on the when() method for for the map view, and also tried to see if the loadError property of the WebMap would have something, but nothing is there.&lt;/P&gt;&lt;P&gt;I looked around the community and code samples, but can't find anything. Any thoughts?&lt;/P&gt;&lt;P&gt;This is what I've tried so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;jimuMapView.view.when()
    .then(m =&amp;gt; {
        const map = jimuMapView.view.map as WebMap;
        map.when().then(mp =&amp;gt; {
            console.log("Map loaded Loaded:");
            console.log(map.loadError)
            console.log(map.loadStatus)
        });
    })
    .catch(error =&amp;gt; {
        console.log("ERROR IN Loading Map View: ");
        console.log(error)
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;Alejandro&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 19:22:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-catch-a-layer-failing-to-load-within-a/m-p/1208388#M78529</guid>
      <dc:creator>AlejandroMari1</dc:creator>
      <dc:date>2022-08-31T19:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to catch a layer failing to load within a webmap (JS API + Experience Builder)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-catch-a-layer-failing-to-load-within-a/m-p/1208430#M78530</link>
      <description>&lt;P&gt;You can use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#event-layerview-create-error" target="_self"&gt;layerview-create-error&lt;/A&gt; event to notify the user that something didn't load properly.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.on("layerview-create-error", function(event) {
  console.error("LayerView failed to create for layer with the id: ", event.layer.id);
});&lt;/LI-CODE&gt;&lt;P&gt;This error will fire for each layer that doesn't load properly&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 20:23:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-catch-a-layer-failing-to-load-within-a/m-p/1208430#M78530</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-08-31T20:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to catch a layer failing to load within a webmap (JS API + Experience Builder)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-catch-a-layer-failing-to-load-within-a/m-p/1208744#M78560</link>
      <description>&lt;P&gt;Thanks Ken! That works well!&lt;/P&gt;&lt;P&gt;Just for reference, yesterday I found that each layer has a &lt;STRONG&gt;loadStatus&lt;/STRONG&gt; and &lt;STRONG&gt;loadError&lt;/STRONG&gt; properties that can be used as well:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const failedLayers = map.layers.filter(i =&amp;gt; i.loadStatus != 'loaded');
if (failedLayers.length &amp;gt; 0) {
	failedLayers.forEach(i=&amp;gt;{
		console.error("Layer Failed to Load");
		console.error(i.loadError);
	});
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 15:18:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-catch-a-layer-failing-to-load-within-a/m-p/1208744#M78560</guid>
      <dc:creator>AlejandroMari1</dc:creator>
      <dc:date>2022-09-01T15:18:16Z</dc:date>
    </item>
  </channel>
</rss>

