Skip to content

Commit

Permalink
fix: add tiff url to error messages TDE-961 (#844)
Browse files Browse the repository at this point in the history
#### Motivation

This change provides the user with more information if an error were to
occur.

#### Modification

`tiff.source.url` added to errror messages.
Resolves a nit in this [PR](#828)

#### Checklist

_If not applicable, provide explanation of why._

~~- [ ] Tests updated~~ - n/a
~~- [ ] Docs updated~~ - n/a
- [x] Issue linked in Title
  • Loading branch information
MDavidson17 authored Feb 1, 2024
1 parent 7dd206a commit 3f4b174
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/commands/path/path.generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,17 @@ export async function loadFirstTiff(source: string, collection: StacCollection):
export function extractGsd(tiff: CogTiff): number {
const gsd = tiff.images[0]?.resolution[0];
if (gsd == null) {
throw new Error(`Missing resolution tiff tag`);
throw new Error(`Missing resolution tiff tag: ${tiff.source.url}`);
}
return gsd;
}

export function extractEpsg(tiff: CogTiff): number {
const epsg = tiff.images[0]?.epsg;
if (epsg == null) {
throw new Error(`Missing epsg tiff tag`);
throw new Error(`Missing epsg tiff tag: ${tiff.source.url}`);
} else if (!Epsg.Codes.has(epsg)) {
throw new Error(`Invalid EPSG code: ${epsg}`);
throw new Error(`Invalid EPSG code: ${epsg} on tiff: ${tiff.source.url}`);
}
return epsg;
}

0 comments on commit 3f4b174

Please sign in to comment.