I'd agree that anywhere that someone is likely to cut and paste from should have decent error checking. If this gets in the way of teaching something, then remove the error checking, but add an icon, or a note about "Fragile code ahead", a heavy border to the example code. You get the idea.
I speak from my experience writing and maintaining approx. 50KLOC of examples written in Java, C and IDL for an expensive integration package. Numerous support calls and crises at this company were directly due to earlier versions of the examples that did not include error-checking.