1 year ago

#344762

test-img

devgioele

Catch mapview-query-error of ArcGIS MapView

I am using the ArcGIS for Javascript library 4.22 and I am trying to run some code when tiles cannot be fetched correctly by ArcGIS. The library prints error messages in the console, but I would like to have some other side effects.

How could I do that?

I tried with mapView.on and mapView.watch, but there seems to be no event for the error mapview-query-error, which occurs when the client's internet connection drops, for example.

The error message printed by the library:

[esri.views.2d.layers.features.sources.FeatureSource] 
{
    "name": "mapview-query-error",
    "message": "Encountered error when fetching tile",
    "details": {
        "tile": {
            "key": {
                "level": 11,
                "row": 723,
                "col": 1088,
                "world": 0
            },
            "bounds": [
                1252344.271421019,
                5870363.772302989,
                1271912.1506620161,
                5889931.65154399
            ],
            "objectIds": {},
            "tileInfoView": { /* omitted */ },
            "resolution": 38.21851414257816,
            "scale": 144447.63857215698,
            "level": 11
        },
        "error": {
            "name": "request:server",
            "message": "Failed to fetch",
            "details": {
                "url": "https://services3.arcgis.com/5IQdSrlG6nfbU9TA/arcgis/rest/services/polygons_001265302111/FeatureServer/0/query",
                "requestOptions": {
                    "query": {
                        "f": "pbf",
                        "geometry": "1252344.271421019,5870363.772302989,1271912.1506620161,5889931.65154399",
                        "maxRecordCountFactor": 4,
                        "resultOffset": 0,
                        "resultRecordCount": 8000,
                        "where": "1=1",
                        "orderByFields": "ObjectId",
                        "outFields": "*",
                        "outSR": 102100,
                        "quantizationParameters": "{\"extent\":{\"xmin\":1252344.271421019,\"ymin\":5870363.772302989,\"xmax\":1271912.1506620161,\"ymax\":5889931.65154399},\"mode\":\"view\",\"originPosition\":\"upperLeft\",\"tolerance\":38.21851414257816}",
                        "resultType": "tile",
                        "spatialRel": "esriSpatialRelIntersects",
                        "geometryType": "esriGeometryEnvelope",
                        "inSR": 102100,
                        "token": "AAPKd857e307032a45ee8190f767169c0d9fP8O1gtVoioRGqLEiMJhZwpnuVFIE0O7CT73pFJq_yoetIoTGP7VD4jJTSQ05QyNA"
                    },
                    "responseType": "array-buffer",
                    "signal": {}
                },
                "ssl": false,
                "httpStatus": 0,
                "raw": {
                    "stack": "TypeError: Failed to fetch\n    at $ (http://localhost:3000/static/js/bundle.js:242159:23)\n    at z (http://localhost:3000/static/js/bundle.js:242262:22)\n    at async C (http://localhost:3000/static/js/bundle.js:242015:13)\n    at async request (http://localhost:3000/static/js/bundle.js:221849:15)",
                    "message": "Failed to fetch"
                }
            }
        }
    }
}

gis

arcgis

arcgis-js-api

0 Answers

Your Answer

Accepted video resources