Dear JS API team,
Just wondering why do you log the following error, when a GoTo is called after another GoTo ?
In my application, it is going by default to an extent. But is the user specify a location, then a query is performed (async operation) and if a result is found it will go to that new location interrupting the previous goTo. It is expected, not an error. Am I missing anything ?
Thanks for listening !
Solved! Go to Solution.
There's some info in the help regarding why this error occurs and how you can use a catch statement to handle (or ignore) the error https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo
There's some info in the help regarding why this error occurs and how you can use a catch statement to handle (or ignore) the error https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo
Nice, thanks ! Should have read more carefully though : everything was there 🙂
@KellyHutchins I don't see anything in the latest API documentation that explains why the "interrupted" error occurs. Has something changed either in the API or in the documentation?
@DaveFullerton it's still documented in the help. If you search for the word "catch" you'll find this paragraph and a code sample:
"This function returns a promise which resolves as soon as the new view has been set to the target. If the transition is animated, then the ongoing animation can be obtained using MapView.animation. If setting the view to the new target fails, the promise returned by the goTo() method rejects with an error. Use a catch statement, to handle the error:"
OK, thanks. I guess it just wasn't clear to me that "an error" meant the view:goto-interrupted error specifically.
I was getting this same error due to a second "goTo" call outside of the promise of the first "goTo" that had not yet resolved.