(self, query, data)
return data
Log a ``{"errors": [...]}`` GraphQL return and return itself.

        :param query: the GraphQL query that triggered the result.
        :type query: str

        :param data: the decoded JSON object.
        :type data: dict

        :return: the input ``data``
        :rtype: dict
Log a ``{"errors": [...]}`` GraphQL return and return itself.
Log a { errors : [ ... ] } GraphQL return and return itself .
def _log_graphql_error(self, query, data):
        '''Log a ``{"errors": [...]}`` GraphQL return and return itself.

        :param query: the GraphQL query that triggered the result.
        :type query: str

        :param data: the decoded JSON object.
        :type data: dict

        :return: the input ``data``
        :rtype: dict
        '''
        if isinstance(query, bytes):  # pragma: no cover
            query = query.decode('utf-8')
        elif not isinstance(query, str):  # pragma: no cover
            # allows sgqlc.operation.Operation to be passed
            # and generate compact representation of the queries
            query = bytes(query).decode('utf-8')

        data = self._fixup_graphql_error(data)
        errors = data['errors']
        self.logger.error('GraphQL query failed with %s errors', len(errors))
        for i, error in enumerate(errors):
            paths = error.get('path')
            if paths:
                paths = ' ' + '/'.join(str(path) for path in paths)
            else:
                paths = ''
            self.logger.info('Error #{}{}:'.format(i, paths))
            for ln in error.get('message', '').split('\n'):
                self.logger.info('   | {}'.format(ln))

            s = self.snippet(query, error.get('locations'))
            if s:
                self.logger.info('   -')
                self.logger.info('   | Locations:')
                for ln in s:
                    self.logger.info('   | {}'.format(ln))
        return data
def _log_graphql_error ( self , query , data ) : if isinstance ( query , bytes ) : # pragma: no cover query = query . decode ( 'utf-8' ) elif not isinstance ( query , str ) : # pragma: no cover # allows sgqlc.operation.Operation to be passed # and generate compact representation of the queries query = bytes ( query ) . decode ( 'utf-8' ) data = self . _fixup_graphql_error ( data ) errors = data [ 'errors' ] self . logger . error ( 'GraphQL query failed with %s errors' , len ( errors ) ) for i , error in enumerate ( errors ) : paths = error . get ( 'path' ) if paths : paths = ' ' + '/' . join ( str ( path ) for path in paths ) else : paths = '' self . logger . info ( 'Error #{}{}:' . format ( i , paths ) ) for ln in error . get ( 'message' , '' ) . split ( '\n' ) : self . logger . info ( '   | {}' . format ( ln ) ) s = self . snippet ( query , error . get ( 'locations' ) ) if s : self . logger . info ( '   -' ) self . logger . info ( '   | Locations:' ) for ln in s : self . logger . info ( '   | {}' . format ( ln ) ) return data