I think that the example with mismatching of the size of colNames
and colModel
is not good example. Is you use cn
and cm
for example as the values of colNames
and colModel
parameters you can just include if (cn.length !== cm.length) {...}
in your code before you create jqGrid. The current code of jqGrid do the same (see here).
In general there are no common way how jqGrid or other plugins reports errors. jQuery for example introduces jQuery.error function which you can overwrite in general. The problem is that the function will be used in very small subset of jQuery code. So it can't really help in my opinion. The most jQuery functions has no validation of input parameters. So you can have unpredictable results if you use wrong parameters.
Moreover many parts of jqGrid code works asynchronously. So one should make validation mostly in other way. I recommend you for example to use loadError
callback. See the answer and another one for more details.