code: def on_complete_resolver(
      on_error, __func, exe_context, info, __resolver, *args, **kwargs
  ):
      try:
          result = __resolver(*args, **kwargs)
          if isinstance(result, Exception):
              return on_error(result)
          # return Promise.resolve(result).then(__func).catch(on_error)
          if is_thenable(result):
              # TODO: Remove this, if a promise is resolved with an Exception,
              # it should raise by default. This is fixing an old behavior
              # in the Promise package
              def on_resolve(value):
                  if isinstance(value, Exception):
                      return on_error(value)
                  return value
  
              return (
                  result.then(on_resolve).then(__func).catch(on_error)
              )
          return __func(result)
      except Exception as e:
          return on_error(e)
  
imports: import sys
  from collections.abc import Iterable
  from functools import partial
  from wandb_promise import Promise, is_thenable
  from ...error import GraphQLError, GraphQLLocatedError
  from ...type import GraphQLEnumType, GraphQLInterfaceType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLScalarType, GraphQLUnionType
  from ..base import default_resolve_fn
  from ...execution import executor
  from .utils import imap, normal_map
label_desc: Use image node_id 1 for calling a global function with example usage: on_complete_resolver(on_error, __func, exe_context, info, __resolver) and returns: __func, on_error, result, on_error, value, on_error