ENB: A new error reporting pattern

16 views
Skip to first unread message

Edward K. Ream

unread,
Feb 13, 2018, 5:01:05 AM2/13/18
to leo-editor
The recent work with the CompareLeoOutlines class has suggested a totally unexpected pattern, namely suppressing internal errors when file errors have been seen. This posts shows that this pattern is valid.

As of 958f6e464 the "oops" error reporting function in fc.resolveArchivedPosition is:

def oops(message):
   
'''Give an error only if no file errors have been seen.'''
   
if not g.unitTesting and self.c.atFileCommands.errors == 0:
        g
.error('bad archived position: %s' % (message))
   
return None

In other words, we suppress the error if at.errors > 0.  This works well in the CompareLeoOutlines class.  The question remains, is this a reasonable thing to do in general?

I believe it is.  Indeed, the only call tree for fc.resolveArchivedPosition is:

fc.readExternalFiles
  fc
.restoreDescendentAttributes
    fc
.resolveArchivedPosition

This will never change.  Furthermore, only fc.readExternalFiles (and its helpers) sets at.errors.

In short, suppressing wonky errors when at.errors > 0 is justified.

Edward
Reply all
Reply to author
Forward
0 new messages