Implement ctxt.error convenience function.

Addresses issue #5