def report_exitcode(code, name='process'):
    """
    Given exit code of a process, throw error / print result as desired
    """
    if code == 0:
        print('[Warning] {} exited with exit code 0'.format(name))
    elif code > 0:
        raise ValueError('[Warning] {} exited with exit code {}'.format(name, code))
    else:
        raise ValueError('[Warning] {} terminated by signal {}'.format(name, code))

    Given exit code of a process, throw error / print result as desired
    
surreal/utils/common.py