More error checking in CodeChain

See: http://forums.kronosaur.com/viewtopic.php?f=30&t=6085