Error checking in the sample code.