From 25ccae9216190b944011832a35359d2c2bbe5cc5 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:57:38 -0400 Subject: [PATCH] player/javascript: disable stream error logging Failure to open a file here should not be treated as an error if the exception is handled by the script. --- player/javascript.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/player/javascript.c b/player/javascript.c index 2469662820..447890456c 100644 --- a/player/javascript.c +++ b/player/javascript.c @@ -354,7 +354,10 @@ static void af_push_file(js_State *J, const char *fname, int limit, void *af) // mp.utils.read_file allows partial read up to limit which results in // error for stream_read_file if the file is larger than limit, so use // STREAM_ALLOW_PARTIAL_READ to allow reading returning partial results. - int flags = STREAM_READ_FILE_FLAGS_DEFAULT | STREAM_ALLOW_PARTIAL_READ; + // Additionally, disable error logging by stream since the exception + // can be caught and handled by a JS script. + int flags = STREAM_READ_FILE_FLAGS_DEFAULT | STREAM_ALLOW_PARTIAL_READ | + STREAM_SILENT; bstr data = stream_read_file2(filename, af, flags, jctx(J)->mpctx->global, limit); if (data.start) {