fix(decorator): noisy errors from decoration provider #31418

Problem:
A broken decoration provider can cause endless errors. #27235

Solution:
Don't show decorator errors when they exceed `DP_MAX_ERROR`.
This commit is contained in:
JD
2024-12-03 06:41:37 -05:00
committed by GitHub
parent 588ca99e12
commit 0e299ebf75

View File

@ -55,14 +55,13 @@ static bool decor_provider_invoke(int provider_idx, const char *name, LuaRef ref
// We get the provider here via an index in case the above call to nlua_call_ref causes // We get the provider here via an index in case the above call to nlua_call_ref causes
// decor_providers to be reallocated. // decor_providers to be reallocated.
DecorProvider *provider = &kv_A(decor_providers, provider_idx); DecorProvider *provider = &kv_A(decor_providers, provider_idx);
if (!ERROR_SET(&err) if (!ERROR_SET(&err)
&& api_object_to_bool(ret, "provider %s retval", default_true, &err)) { && api_object_to_bool(ret, "provider %s retval", default_true, &err)) {
provider->error_count = 0; provider->error_count = 0;
return true; return true;
} }
if (ERROR_SET(&err)) { if (ERROR_SET(&err) && provider->error_count < DP_MAX_ERROR) {
decor_provider_error(provider, name, err.msg); decor_provider_error(provider, name, err.msg);
provider->error_count++; provider->error_count++;