Skip to content

Commit 203a091

Browse files
committed
Better error handling in getResultsAsStac Open-EO/openeo-web-editor#181
1 parent 915850c commit 203a091

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Return a better error message if issues with reading batch job results occur in `Job.getResultsAsStac`
12+
913
## [2.0.1] - 2021-07-14
1014

1115
### Fixed
@@ -122,4 +126,4 @@ All prior releases have been documented in the [GitHub Releases](https://github.
122126
[1.0.3]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.2...v1.0.3
123127
[1.0.2]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.1...v1.0.2
124128
[1.0.1]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.0...v1.0.1
125-
[1.0.0]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.0-rc.5...v1.0.0
129+
[1.0.0]: https://github.com/Open-EO/openeo-js-client/compare/v1.0.0-rc.5...v1.0.0

src/job.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ class Job extends BaseEntity {
265265
*/
266266
async getResultsAsStac() {
267267
let response = await this.connection._get('/jobs/' + this.id + '/results');
268+
if (!Utils.isObject(response) || !Utils.isObject(response.data)) {
269+
throw new Error("Results received from the back-end are invalid");
270+
}
268271
let data = StacMigrate.stac(response.data);
269272
if (!Utils.isObject(data.assets)) {
270273
data.assets = {};

0 commit comments

Comments
 (0)