'Check if there were any errors and, if so, raise exceptions.
:raise SendPackError: Raised when the server could not unpack
:raise UpdateRefsError: Raised when refs could not be updated'

def check(self):

    if (self._pack_status not in ('unpack    ok', None)):
        raise SendPackError(self._pack_status)
    if (not self._ref_status_ok):
        ref_status = {}
        ok = set()
        for status in self._ref_statuses:
            if ('    ' not in status):
                continue
            (status, ref) = status.split('    ', 1)
            if (status == 'ng'):
                if ('    ' in ref):
                    (ref, status) = ref.split('    ', 1)
            else:
                ok.add(ref)
            ref_status[ref] = status
        raise UpdateRefsError((',    '.join([refname.decode('ascii') for refname in ref_status if (refname not in ok)]) + '    failed    to    update'), ref_status=ref_status)
