fix error handler not displaying errors on startup
This commit is contained in:
parent
112ffdf80b
commit
4a471d39b1
@ -131,7 +131,6 @@ class ErrorHandler(io.TextIOWrapper):
|
|||||||
self.data = None
|
self.data = None
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
assert not (self.cli is None or self.target_logger is None)
|
|
||||||
if self.closed:
|
if self.closed:
|
||||||
raise ValueError("write to closed file")
|
raise ValueError("write to closed file")
|
||||||
if not isinstance(data, str):
|
if not isinstance(data, str):
|
||||||
@ -144,6 +143,11 @@ class ErrorHandler(io.TextIOWrapper):
|
|||||||
return length
|
return length
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
|
# Probably a syntax error on startup, so these aren't defined yet
|
||||||
|
# If we do nothing, the error magically is printed to the console
|
||||||
|
if self.cli is None or self.target_logger is None:
|
||||||
|
return
|
||||||
|
|
||||||
self.buffer.flush()
|
self.buffer.flush()
|
||||||
|
|
||||||
if self.data is None:
|
if self.data is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user