Improve error message for zero monitor timeout values

The error message was not 100% accurate about the value. In addition to
that, neither the value itself nor the monitor or parameter names were
printed in the error message.
This commit is contained in:
Markus Mäkelä
2017-11-17 17:09:49 +02:00
parent 84d1ea0bff
commit 07e58444f6
4 changed files with 16 additions and 12 deletions

View File

@ -668,8 +668,7 @@ void monitorSetScriptTimeout(MXS_MONITOR *mon, uint32_t value)
* @param type The timeout handling type
* @param value The timeout to set
*/
bool
monitorSetNetworkTimeout(MXS_MONITOR *mon, int type, int value)
bool monitorSetNetworkTimeout(MXS_MONITOR *mon, int type, int value, const char* key)
{
bool rval = true;
@ -695,13 +694,14 @@ monitorSetNetworkTimeout(MXS_MONITOR *mon, int type, int value)
default:
MXS_ERROR("Monitor setNetworkTimeout received an unsupported action type %i", type);
ss_dassert(!true);
rval = false;
break;
}
}
else
{
MXS_ERROR("Negative value for monitor timeout.");
MXS_ERROR("Value '%s' for monitor '%s' is not a positive integer: %d", key, mon->name, value);
rval = false;
}
return rval;