Desktop User Guides > 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 cause the interview to end immediately. The respondent usually sees an error message, but since it has been generated by the interviewing program, it might not be helpful. Sometimes, your own testing catches 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 are error‑free. The best way to cater for unexpected errors is to write an error handling function. This traps the errors before they make the interview fail, and allows you to either to terminate the interview with a message of your choice, or 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 might 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 scripts
Writing your own error handler
See also
Dealing with errors