Skip to content

Commit 92df88c

Browse files
committed
grails4 (biocache 500 exception handler)
1 parent 33b7022 commit 92df88c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Diff for: grails-app/assets/javascripts/spApp/service/biocacheService.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,23 @@
619619
*/
620620
bbox: function (query) {
621621
return this.registerQuery(query).then(function (response) {
622+
var bbox = [[-180, -90], [180, 90]]
622623
if (response == null) {
623-
return $q.when([[-180, -90], [180, 90]])
624+
return $q.when(bbox)
624625
}
625626
return $http.get(query.bs + "/webportal/bbox?q=" + response.qid + "&type=application/json", _httpDescription('bbox')).then(function (response) {
626-
var bb = response.data.split(",");
627-
return [[bb[1], bb[0]], [bb[3], bb[2]]];
628-
});
627+
try {
628+
var bb = response.data.split(",");
629+
bbox = [[bb[1], bb[0]], [bb[3], bb[2]]];
630+
} catch (exception) {
631+
console.warn("Error: Biocache/bbox query return an invalid BBox.")
632+
} finally {
633+
return bbox;
634+
}
635+
}).catch(function (error) {
636+
console.warn("Biocache/bbox query returns an error!")
637+
return bbox;
638+
})
629639
})
630640
},
631641
/**

Diff for: grails-app/assets/javascripts/spApp/spApp.js

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ spApp.config(['$httpProvider', function ($httpProvider) {
124124
window.location.reload();
125125
}
126126
}
127-
console.log(JSON.stringify(rejection.data))
128127
return $q.reject(rejection);
129128
}
130129
};

0 commit comments

Comments
 (0)