Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Dealing with errors
Dealing with errors
When a respondent selects or enters an answer, the interviewing program compares that answer against the requirements for the question. If the response is valid, the interviewing program accepts it and proceeds with the next instruction in the routing section of the script. If the response is invalid, the interviewing program displays an error message and waits for the respondent to correct the error.
This type of error handling is called validation and it happens automatically as part of the Ask statement for each question. Errors that occur while executing the routing script are called script errors, and include things such as division by zero, out-of-range subscripts, or data type mismatches. You should write an error handling routine in the routing section to deal with these errors.
How validation works: How .Ask() validation works
Standard error messages
Replacing the standard message texts
Preventing cross-site scripting in text responses
Using a custom validation function: Using a custom validation function for validation not covered by the standard messages
Handling script errors: Writing an error handling routing to process non-validation errors.
See also
Writing interview scripts