Closed abingham closed 4 years ago
This is 50% intentional and 50% accidental. Most of the time, errors reported by the logging system should be "friendly" and contain an explanation of what happened, so the type is just noise. However, sometimes an "internal" error bubbles up and now it's all confusing. I should probably fix this by tagging all the "friendly" errors with a particular base type so bfg knows that they don't need their type logged. In the short term, you can add --debug
to get the full stack trace, which should indicate the type wherever the exception is raised...
As for why you're getting that error, Path
objects are a "safe string" type, and those are forbidden from being turned into regular strings via str
. This is to ensure that the build backends are able to properly add escape sequences so that everything works right. The solution here is to remove the str()
call, since find_files()
should be able to accept a Path
object (if not, there's a bug).
I should probably fix this by tagging all the "friendly" errors with a particular base type so bfg knows that they don't need their type logged.
This ended up not working out very well, since some built-in Python exception types (e.g. TypeError
) should sometimes be friendly errors and sometimes not. So now the NotImplementedError
has a nice message, and passing --debug
adds the exception type to the terminal output.
It seems that bfg's error reporting for exceptions hides the exception type. For example, here's a portion of an error report it produces:
What's going on is that
exclude_pycache
(used in the filter) is callingstr()
on abfg9000.platforms.posix.PosixPath
. This results in aNotImplementedError
(which in itself is strange) that has no message. It appears that the log formatting applied to theStackfulStreamHandler
is actively discarding exception information, so by the time it produces logging output it can't tell me anything about what went wrong in this case.In cases like this, where I'm still finding my way through bfg and doing "incorrect" things like stringifying paths, it would be very helpful to get a better indication of what went wrong.