Skip to content

Commit ffb9f2b

Browse files
committed
save errors when main thread crashes
1 parent a6a98ec commit ffb9f2b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

spotdl/console/entry_point.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,15 @@ def graceful_exit(_signal, _frame):
143143
query=arguments.query,
144144
downloader=downloader,
145145
)
146-
except Exception:
146+
except Exception as exc:
147+
if downloader_settings["save_errors"]:
148+
with open(
149+
downloader_settings["save_errors"], "a", encoding="utf-8"
150+
) as error_file:
151+
error_file.write("\n".join([exc + "\n" for exc in exc.args]))
152+
153+
logger.debug("Saved errors to %s", downloader_settings["save_errors"])
154+
147155
end_time = time.perf_counter()
148156
logger.debug("Took %d seconds", end_time - start_time)
149157

0 commit comments

Comments
 (0)