Open HolQue opened 1 month ago
The rework of the error messages also includes to have a unique structure in mind. This also eases the readability and understandability.
At first the pure error, e.g.: 'str' object does not support item assignment'
After this: line or expression, where the error happens (if detectable)
Finally: impact or further details or hints about how to solve (but only if it's really helpful or required to understand the meaning of the error), e.g:
Hi Holger,
usually the jpp files will be used to configure the behavior of any code. Therefore from my point of view we define parameters.,
=> we shall use nowhere the word variable
, but instead parameter
/ parameters
.
w.r.t error messages: We can do it this or that way. Only important is, that all error messages have a unified structure.
Proposals like e.g. below are fine for me. It avoids the word "parameter", has the same message content and is shorter.
Instead of:
'Invalid index or dictionary key in parameter '${dictP}[${dictP}]'. The datatype of variable '${dictP}' have to 'int' or 'str'.'
Alternative version:
Key error: Dictionary keys have to be of type int or str (expression: '${dictP}[${dictP}]').
Regards, Thomas
Hi @namsonx , plesae consider this from now onwards for all your activities. Thank you, Thomas
In error messages sometimes the term '
variable
' is used, sometimes the term 'parameter
'. In some cases both of them:Does this usage currently follow a certain rule? What is the difference between 'parameter' and 'variable'? In internet a lot of discussions about this question can be found; also definitions. Sometimes very academic.
Can we - in the context of the JsonPreprocessor - take over these definitions? Or in other words: Does it make sense for the JsonPreprocessor to distinguish between a variable and a parameter?
My personal feeling is that it's better to use only one of these terms.
And because of I feel really uncomfortable with this topic in general, I would try to avoid the term '
parameter
' and 'variable
' as much as possible ;-)For example:
Instead of:
'Could not set variable '${keyP.${indexP}}' with value 'newvalue'! Reason: 'str' object does not support item assignment'
Better:
'str' object does not support item assignment' (expression: '${keyP.${indexP}}').
Instead of:
'Invalid index or dictionary key in parameter '${dictP}[${dictP}]'. The datatype of variable '${dictP}' have to 'int' or 'str'.'
Alternative version:
Key error: Dictionary keys have to be of type int or str (expression: '${dictP}[${dictP}]').
Instead of:
'Invalid syntax: Found index or sub-element inside curly brackets in the parameter '${dictP[${dictP}]}''
Alternative version:
'Invalid syntax: Found index or sub-element inside curly brackets (expression: '${dictP[${dictP}]}')'
Current version:
'The implicit creation of data structures based on parameter is not supported. New parameter '0['0']' could not be created by the expression '${indexP}['${indexP}']''
Alternative version:
The implicit creation of data structures based on parameters is not supported (expression: '${testdict.B}['${name}']').
See also https://github.com/test-fullautomation/python-jsonpreprocessor/issues/237What do you think?