Abstracted a common error-handling function.
Abstracted error handling functions.  First draft of declaration derivation.