@contextmanager
def raise_on_meta_error(funcname=None):
 try:
  (yield)
 except Exception as e:
  (exc_type, exc_value, exc_traceback) = sys.exc_info()
  tb = ''.join(traceback.format_tb(exc_traceback))
  msg = 'Metadata inference failed{0}.\n\nOriginal error is below:\n------------------------\n{1}\n\nTraceback:\n---------\n{2}'.format((' in `{0}`'.format(funcname) if funcname else ''), repr(e), tb)
  raise ValueError(msg)

@ contextmanager def raise_on_meta_error ( funcname = None ) : try : ( yield ) except Exception as e : ( exc_type , exc_value , exc_traceback ) = sys . exc_info ( ) tb = '' . join ( traceback . format_tb ( exc_traceback ) ) msg = 'Metadata inference failed{0}.\n\nOriginal error is below:\n------------------------\n{1}\n\nTraceback:\n---------\n{2}' . format ( ( ' in `{0}`' . format ( funcname ) if funcname else '' ) , repr ( e ) , tb ) raise ValueError ( msg )
reraise errors in this block to show metadata inference failure .