Professional > Interview scripting > Writing interview scripts > Dealing with errors > Handling script errors
 
Handling script errors
Non-validation errors are errors that happen when the routing instructions tell the interviewing program to perform an impossible task. They are sometimes called run-time errors and include things such as:
out-of-range subscripts: for example, referring to variable[6] when there are only five cells in the variable
data type mismatches: for example, adding a numeric value to a text value
invalid text substitutions: for example, substituting text into an unknown banner or text variable
division by zero.
These types of errors always cause the interview to end immediately. The respondent will usually see an error message, but since it has been generated by the interviewing program itself it may not be very helpful. Sometimes your own testing will catch these types of errors, but unless you are careful to test every possible combination of responses in an interview you cannot be sure that all interviews will be error free. The best way to cater for unexpected errors is to write an error handling function. This will trap the errors before they have a chance to make the interview fail, and allows you either to terminate the interview with a message of your choice or to ignore the error and continue with the next question.
You can make your error handler as simple or complex as you like, depending on the project’s requirements. You can even define two error handlers and use different ones depending on how far through the script the respondent is. If the interviews are long, you may decide that if respondents have reached a certain point in the interview you would rather ignore the error and collect what data you can, whereas if the respondent has only just started an interview you will allow it end immediately.
More information about writing error handlers
Script to demonstrate script errors
A suggested error handler for your scripts
Writing your own error handler
See also
Dealing with errors