Skip to content

Instantly share code, notes, and snippets.

@pranavkulkarni
Created September 14, 2017 17:26
Show Gist options
  • Save pranavkulkarni/51de24753f3a30c03d0144ba89e51d7e to your computer and use it in GitHub Desktop.
Save pranavkulkarni/51de24753f3a30c03d0144ba89e51d7e to your computer and use it in GitHub Desktop.
Compose scenarios
// 1. fetchItem failed
[
{
errors: [
{
message:
'400 GWM_0001 Specified output format not supported. http://www.arcgis.com/sharing/rest/content/ite/0c5c72721ac049b98d9f4c27a4877254?f=json',
url:
'http://www.arcgis.com/sharing/rest/content/ite/0c5c72721ac049b98d9f4c27a4877254?f=json',
statusCode: 400,
name: 'HTTPError',
timestamp: 1505405620973,
stack:
'400 GWM_0001 Specified output format not supported. http://www.arcgis.com/sharing/rest/content/ite/0c5c72721ac049b98d9f4c27a4877254?f=json',
field: 'item'
}
],
item: {}
}
];
// 2. fetchMetadata failed
{
errors: [
{
message:
'400 Bad Request http://www.arcgis.com/sharing/rest/content/items/0c5c72721ac049b98d9f4c27a4877254/info/metadata/metadata.xml',
url:
'http://www.arcgis.com/sharing/rest/content/items/0c5c72721ac049b98d9f4c27a4877254/info/metadata/metadata.xml',
statusCode: 400,
name: 'HTTPError',
timestamp: 1505405753476,
stack:
'400 Bad Request http://www.arcgis.com/sharing/rest/content/items/0c5c72721ac049b98d9f4c27a4877254/info/metadata/metadata.xml',
field: 'metadata'
}
],
item: {
id: '0c5c72721ac049b98d9f4c27a4877254',
owner: 'amartin_usnsdi'
// ...
},
groups: { admin: [], member: [], other: [[Object], [Object]] },
metadata: {},
default: {
id: '0c5c72721ac049b98d9f4c27a4877254',
composedAt: 1505405753476,
url: null,
source: { source: 'amartin_usnsdi', sourceProvenance: 'item.owner' },
composeStatus: { pass: true }
// ...
}
};
// 3. Purposely generated native nodejs error in composeDataset function
{
errors: [
{
message:
'400 Bad Request http://www.arcgis.com/sharing/rest/content/items/0c5c72721ac049b98d9f4c27a4877254/info/metadata/metadata.xml',
url:
'http://www.arcgis.com/sharing/rest/content/items/0c5c72721ac049b98d9f4c27a4877254/info/metadata/metadata.xml',
statusCode: 400,
name: 'HTTPError',
timestamp: 1505406357853,
stack:
'400 Bad Request http://www.arcgis.com/sharing/rest/content/items/0c5c72721ac049b98d9f4c27a4877254/info/metadata/metadata.xml',
field: 'metadata'
},
{
message: "Cannot read property 'y' of undefined",
name: 'TypeError',
stack:
"TypeError: Cannot read property 'y' of undefined\n at Object.determineSource (/Users/pran8670/Documents/workspace/TheDuke/dist/bundle-umd.js:91:13)\n at composeDataset (/Users/pran8670/Documents/workspace/TheDuke/dist/bundle-umd.js:259:24)\n at composeDatasets (/Users/pran8670/Documents/workspace/TheDuke/dist/bundle-umd.js:296:19)\n at /Users/pran8670/Documents/workspace/TheDuke/dist/bundle-umd.js:355:39\n at tryCatcher (/Users/pran8670/Documents/workspace/TheDuke/node_modules/rsvp/dist/rsvp.js:341:19)\n at invokeCallback (/Users/pran8670/Documents/workspace/TheDuke/node_modules/rsvp/dist/rsvp.js:519:31)\n at publish (/Users/pran8670/Documents/workspace/TheDuke/node_modules/rsvp/dist/rsvp.js:504:7)\n at flush (/Users/pran8670/Documents/workspace/TheDuke/node_modules/rsvp/dist/rsvp.js:2448:5)\n at _combinedTickCallback (internal/process/next_tick.js:131:7)\n at process._tickDomainCallback (internal/process/next_tick.js:218:9)",
timestamp: 1505406357856,
field: 'default'
}
],
item: {
id: '0c5c72721ac049b98d9f4c27a4877254'
// ...
},
groups: { admin: [], member: [], other: [[Object], [Object]] },
metadata: {},
default: {
composeStatus: { pass: false },
id: '0c5c72721ac049b98d9f4c27a4877254'
}
};
// 4. An item associated with 2 layers has consitent structure for consolidated and layer datasets
['errors', 'item', 'groups', 'server', 'layers', 'metadata', 'default'];
// The layer dataset has layers field with one layer which is itself example -
layers = [
{
currentVersion: 10.51,
id: 2,
name: 'USA Freeway System (below 1:500k)',
type: 'Feature Layer',
capabilities: 'Query'
// ...
}
];
// The default field of a layers dataset looks like this
defaultForLayerDataset = {
{ id: '91c6a5f6410b4991ab0db1d7c26daacb_2',
description: 'This layer presents rural and urban interstate highways. It is part of the National Highway Planning Network, published by the Federal Highway Administration as part of the National Transportation Atlas Databases for the United States. It provides a comprehensive database of interstate highways from the nation\'s principal arterial highway system and the National Highway System. The data is generalized to improve draw performance and be used effectively at a national level.',
type: 'Dataset',
name: 'USA Freeway System (below 1:500k)',
spatialReference: 4326,
composedAt: 1505409938520,
url: 'https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Freeway_System/FeatureServer/2',
source: { source: 'esri', sourceProvenance: 'item.owner' },
composeStatus: { pass: true } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment