Skip to content

Commit

Permalink
Better error handling in getResultsAsStac Open-EO/openeo-web-editor#181
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jul 22, 2021
1 parent 915850c commit 203a091
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Return a better error message if issues with reading batch job results occur in `Job.getResultsAsStac`

## [2.0.1] - 2021-07-14

### Fixed
Expand Down Expand Up @@ -122,4 +126,4 @@ All prior releases have been documented in the [GitHub Releases](https://github.
[1.0.3]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.2...v1.0.3
[1.0.2]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.0-rc.5...v1.0.0
[1.0.0]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.0-rc.5...v1.0.0
3 changes: 3 additions & 0 deletions src/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ class Job extends BaseEntity {
*/
async getResultsAsStac() {
let response = await this.connection._get('/jobs/' + this.id + '/results');
if (!Utils.isObject(response) || !Utils.isObject(response.data)) {
throw new Error("Results received from the back-end are invalid");
}
let data = StacMigrate.stac(response.data);
if (!Utils.isObject(data.assets)) {
data.assets = {};
Expand Down

0 comments on commit 203a091

Please sign in to comment.