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

fix(i3s-scene-parser): provide unsupported layer types in the exception #2863

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion modules/i3s/src/lib/parsers/parse-arcgis-webscene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ const SUPPORTED_LAYERS_TYPES = [
const NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = 'NO_AVAILABLE_SUPPORTED_LAYERS_ERROR';
const NOT_SUPPORTED_CRS_ERROR = 'NOT_SUPPORTED_CRS_ERROR';

class LayerError extends Error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some TSDocs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TSDocs added.
One more change - the LayerError is exported so it's available in the I3s-explorer where the exception is being handled.

constructor(
message: string,
public details: unknown
) {
super(message);
this.name = 'LayerError';
}
}

/**
* Parses ArcGIS WebScene
* @param data
Expand All @@ -36,7 +46,7 @@ export async function parseWebscene(data: ArrayBuffer): Promise<ArcGISWebSceneDa
const {layers, unsupportedLayers} = await parseOperationalLayers(operationalLayers, true);

if (!layers.length) {
throw new Error(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR);
throw new LayerError(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR, unsupportedLayers);
}

return {
Expand Down
Loading