Select to view content in your preferred language

JS API 4.X: why is "Goto was interrupted" logged as an error ??

5536
6
Jump to solution
12-16-2020 09:53 AM
NicolasGIS
Frequent Contributor

Dear JS API team,

Just wondering why do you log the following error, when a GoTo is called after another GoTo ?

GoTo.JPG

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 !

 

Tags (2)
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor

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

View solution in original post

6 Replies
KellyHutchins
Esri Frequent Contributor

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

NicolasGIS
Frequent Contributor

Nice, thanks ! Should have read more carefully though : everything was there 🙂

0 Kudos
DaveFullerton
Frequent Contributor

@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?

0 Kudos
KellyHutchins
Esri Frequent Contributor

@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:"

DaveFullerton
Frequent Contributor

OK, thanks.  I guess it just wasn't clear to me that "an error" meant the view:goto-interrupted error specifically.

0 Kudos
GregoryBologna
Frequent Contributor

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.

0 Kudos