Skip to content

Commit 532aed3

Browse files
committed
Added try except
1 parent 03753f3 commit 532aed3

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/pytask_vscode/execution.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@
55

66
@pytask.hookimpl(tryfirst=True)
77
def pytask_execute_task_log_end(session: pytask.Session, report: pytask.ExecutionReport) -> None:
8-
9-
if not session.config["dry_run"]:
10-
attrs = {"type" : "task" ,"name" : report.task.short_name, "path" : str(report.task.path), "report" : str(report.outcome)}
11-
address = ('localhost', 6000)
12-
conn = Client(address, authkey=b'secret password')
13-
conn.send(json.dumps(attrs))
14-
conn.close()
15-
8+
try:
9+
if not session.config["dry_run"]:
10+
attrs = {"type" : "task" ,"name" : report.task.short_name, "path" : str(report.task.path), "report" : str(report.outcome)}
11+
address = ('localhost', 6000)
12+
conn = Client(address, authkey=b'secret password')
13+
conn.send(json.dumps(attrs))
14+
conn.close()
15+
except Exception as e:
16+
pass
1617
@pytask.hookimpl
1718
def pytask_execute_log_end(session: pytask.Session, reports: list[pytask.ExecutionReport]) -> None:
18-
if not session.config["dry_run"]:
19-
address = ('localhost', 6000)
20-
conn = Client(address, authkey=b'secret password')
21-
conn.send('close')
22-
conn.close()
19+
try:
20+
if not session.config["dry_run"]:
21+
address = ('localhost', 6000)
22+
conn = Client(address, authkey=b'secret password')
23+
conn.send('close')
24+
conn.close()
25+
except Exception as e:
26+
pass

0 commit comments

Comments
 (0)