18 lines
416 B
Python
18 lines
416 B
Python
import re
|
|
import sys
|
|
|
|
def extract_errors(s: str, limit: int = 120):
|
|
lines = s.splitlines()
|
|
errs = []
|
|
for ln in lines:
|
|
if any(tok in ln for tok in ("error[E", "panicked at", "FAILED", "error:")):
|
|
errs.append(ln)
|
|
if len(errs) >= limit:
|
|
break
|
|
return "\n".join(errs)
|
|
|
|
if __name__ == "__main__":
|
|
text = sys.stdin.read()
|
|
print(extract_errors(text))
|
|
|