def croak(error, message_writer=message):
    """Throw an exception in the Maltego GUI containing error_msg."""
    if isinstance(error, MaltegoException):
        message_writer(MaltegoTransformExceptionMessage(exceptions=[error]))
    else:
        message_writer(MaltegoTransformExceptionMessage(exceptions=[MaltegoException(error)]))
Throw an exception in the Maltego GUI containing error_msg.