tokami / StockMonitoringTool

0 stars 0 forks source link

Error messaging consistency (Dev/Expert) #58

Closed aenieblas closed 3 years ago

aenieblas commented 3 years ago

(Expert opinion required, recommendations can be implemented by developer)

When inputting parameters outside of the allowable range, the top error message is "Incorrect moving average (MA) value! Please provide an odd integer (e.g. 3,5,7) and run again." and the bottom error message is generally sensible relative to the input error, e.g. probability of mutation, probability of crossover >1, the error is :

"Incorrect moving average (MA) value! Please provide an odd integer (e.g. 3,5,7) and run again. Error in GA::ga(type = "real-valued", fitness = sofun, lfq = lfq, lower = min, : Probability of crossover must be between 0 and 1.”

or with pop size and max generation <0, the error is :

"Incorrect moving average (MA) value! Please provide an odd integer (e.g. 3,5,7) and run again. Error in seq.default(floor(tmax - ncohort), floor(tmax), by = 1): 'from' must be a finite number"

It would be better to either set a more general top error message than the MA value issue (e.g. "Parameter value outside allowable range! Please review your parameter values and try again. Error in GA::ga(type = "real-valued", fitness = sofun, lfq = lfq, lower = min, : Probability of crossover must be between 0 and 1.”,

letting the user understand the problem from the bottom part of the error message, or try to make both parts of the error message specific and sensible for the user (preferred solution), e.g.

"Probability of crossover must be between 0 and 1. Please review your parameter values and try again. Error in GA::ga(type = "real-valued", fitness = sofun, lfq = lfq, lower = min, : Probability of crossover must be between 0 and 1.”

tokami commented 3 years ago

!is.null(grep(....))) does not make sense. This has been corrected together with fix for issue #59.