It depends a lot on what scripts and commands you're using.
I'll put an example here:
if (not CreateDialog "SELECT_DIFFICULTY") then {hint"Problem opening Dialog";DifficultySelected = true}
Basically what this does is tell me if there is any problem in loading up the dialog that I have created. If a problem is detected, then a hint is made which tells me so. This is one example.
You could do something like this:
if DeBug then {player sidechat format["overcast level = %1; max. level = %2 rain level = %3",_overcast,_currentMax,RainLevel]}
Here, 'Debug' is a global variable, and if it is made true at point during the mission, I can make hints or in this case, sidechats appear which tell me what's going on in the script, and what data is being created, etc.
In this particular example, I've used the sidechat command to tell me the values of other global and local variables.
This is basically how you can error trap.
Hope this helps
Gruntage