Moved few error handling functions to runtime/errors