Stop outputting at 10 errors, use warning instead of error

This commit is contained in:
pietervdvn 2021-06-24 02:31:02 +02:00
parent 6692504887
commit d8330ed8c2

View file

@ -91,6 +91,7 @@ export default class MetaTagging {
} }
private static errorPrintCount = 0; private static errorPrintCount = 0;
private static readonly stopErrorOutputAt = 10;
private static createRetaggingFunc(layer: LayerConfig): private static createRetaggingFunc(layer: LayerConfig):
((params: Params, feature: any) => void) { ((params: Params, feature: any) => void) {
@ -123,11 +124,11 @@ export default class MetaTagging {
} }
feature.properties[key] = result; feature.properties[key] = result;
} catch (e) { } catch (e) {
if(MetaTagging. errorPrintCount < 50){ if(MetaTagging. errorPrintCount < MetaTagging.stopErrorOutputAt){
console.error("Could not calculate a metatag defined by " + code + " due to " + e + ". This is code defined in the theme. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features", e) console.warn("Could not calculate a calculated tag defined by " + code + " due to " + e + ". This is code defined in the theme. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features", e)
MetaTagging. errorPrintCount ++; MetaTagging. errorPrintCount ++;
if(MetaTagging. errorPrintCount == 50){ if(MetaTagging. errorPrintCount == MetaTagging.stopErrorOutputAt){
console.error("Got 50 errors calculating this metatagging - stopping output now") console.error("Got ",MetaTagging.stopErrorOutputAt," errors calculating this metatagging - stopping output now")
} }
} }
} }