forked from MapComplete/MapComplete
Robustify in the case of werid hashes
This commit is contained in:
parent
04cd7b6c16
commit
cd1ee64f62
1 changed files with 48 additions and 37 deletions
|
@ -1,6 +1,6 @@
|
||||||
import {UIEventSource} from "../UIEventSource";
|
import {UIEventSource} from "../UIEventSource";
|
||||||
import FeatureSource from "../FeatureSource/FeatureSource";
|
import FeatureSource from "../FeatureSource/FeatureSource";
|
||||||
import {OsmObject, OsmObjectMeta} from "../Osm/OsmObject";
|
import {OsmObject} from "../Osm/OsmObject";
|
||||||
import Loc from "../../Models/Loc";
|
import Loc from "../../Models/Loc";
|
||||||
import FeaturePipeline from "../FeatureSource/FeaturePipeline";
|
import FeaturePipeline from "../FeatureSource/FeaturePipeline";
|
||||||
import OsmApiFeatureSource from "../FeatureSource/OsmApiFeatureSource";
|
import OsmApiFeatureSource from "../FeatureSource/OsmApiFeatureSource";
|
||||||
|
@ -33,7 +33,13 @@ export default class SelectedFeatureHandler {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
hash.addCallbackAndRun(h => self.downloadFeature(h))
|
hash.addCallbackAndRunD(h => {
|
||||||
|
try {
|
||||||
|
self.downloadFeature(h)
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Could not download feature, probably a weird hash")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
featureSource.features.addCallback(_ => self.selectFeature());
|
featureSource.features.addCallback(_ => self.selectFeature());
|
||||||
|
|
||||||
|
@ -82,7 +88,12 @@ export default class SelectedFeatureHandler {
|
||||||
if (SelectedFeatureHandler._no_trigger_on.indexOf(hash) >= 0) {
|
if (SelectedFeatureHandler._no_trigger_on.indexOf(hash) >= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
|
||||||
this._osmApiSource.load(hash)
|
this._osmApiSource.load(hash)
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Could not download feature, probably a weird hash:", hash)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private selectFeature() {
|
private selectFeature() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue