Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ImageOveray Error handling. #941

Merged
merged 1 commit into from
Mar 29, 2017
Merged

Added ImageOveray Error handling. #941

merged 1 commit into from
Mar 29, 2017

Conversation

Saulzi
Copy link
Contributor

@Saulzi Saulzi commented Mar 28, 2017

This builds on leafet pr 5416 and adds basic error handling when loading of underlying ImageOverlays fails to esri-leaflet.

I am not sure how to add to your documentation with regards to adding the new event raised.

@jgravois
Copy link
Contributor

so cool to see a user not only making contributions to this project, but also upstream!

do you know of a way that i can simulate an error loading an image directly in the browser to check out the behavior in action? i tried the below and it didn't throw

// typo in service name ensures an error is returned from the server instead of an image
var dyn = L.esri.dynamicMapLayer({
  url:'http://sampleserver6.arcgisonline.com/arcgis/rest/services/Censs/MapServer',
}).addTo(map);

// not fired
dyn.on('error', function (e) {
  console.log(e);
})

@Saulzi
Copy link
Contributor Author

Saulzi commented Mar 29, 2017

Have you made a build of leaflet as ImageLayer error functionality is 'bleeding edge' and was only merged into master yesterday. it should be in their next release. I will try your example shortly with a build of master.

@Saulzi
Copy link
Contributor Author

Saulzi commented Mar 29, 2017

Example.zip

The reason why your example was not working is because by default the layer will call the service which returns json with urls of images (this currently gives a different error above) which are then added to the map.

Setting the image type to gif basically short cuts this and will therefore raise the image.onerror event which is hooked up in the ImageOverlay (and subscribed to in DynamicMapLayer).

Please find attached copy of your example above with build of master on leaflet and the image-overlay-error-support branch from my repo.

@jgravois
Copy link
Contributor

Have you made a build of leaflet [...]?

whoops! thanks for reminding me.

a little local npm link action (along with remembering to check out your own branch again) was all i needed to see your work for myself. thanks again for this contribution.

seeing as how i just released v2.0.8 i feel good about merging this work now and holding off on tagging again until after leaflet v1.1.0 lands.

as for the doc, i'll add it here shortly.

@jgravois jgravois merged commit 43d8e8d into Esri:master Mar 29, 2017
jgravois added a commit to jgravois/esri-leaflet that referenced this pull request Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants