Replace KeyError with CPSFormulaError

KeyError was a poor choice in this context, because dictionary lookups
are controlled partly by listening for KeyError.
Also, KeyError was not imported by the module (see #219)