Fix silent failure for some Osmose error types

When I added special handling for mapillary errors the code was trying
to access translation strings nested under the error category (which
doesn't exist for all error types). This code is now moved into it's own
function so that variable hoisting doesn't run it for non-applicable
error types and prevent them from working.

- Also adds support for error type 3040 (bad tag value)
- Updated the Osmose sidebar UI title
This commit is contained in:
SilentSpike
2019-12-30 16:20:54 +00:00
parent a068cdfc59
commit 896ed762e0
6 changed files with 34 additions and 9 deletions
+17 -4
View File
@@ -144,13 +144,10 @@ export default {
// Special handling for some error types
// Setting elems here prevents UI error detail requests
var parts = dataEn.QA.osmose.error_types[d.item].parts;
switch (d.item) {
case 8300:
case 8360:
// todo: possible to add link to open mapillay photo overlay?
d.replacements = [parts[d.class]];
d.elems = [];
mapillaryError(d);
break;
}
@@ -167,6 +164,13 @@ export default {
_erCache.loadedTile[tile.id] = true;
});
});
function mapillaryError(d) {
// Parts only exists for these error types
var parts = dataEn.QA.osmose.error_types[d.item].parts;
d.replacements = [parts[d.class]];
d.elems = [];
}
},
loadErrorDetail: function(d, callback) {
@@ -192,6 +196,15 @@ export default {
return linkEntity(i);
});
// Special handling for some error types
switch (d.item) {
case 3040:
d.replacements.push(/Bad value for (.+)/i
.exec(data.subtitle)[1]
);
break;
}
that.replaceError(d);
if (callback) callback(null, d);
})