From 076decd6e96069d60baa1bac29c4c549edeab1a8 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 25 Nov 2019 09:47:42 -0500 Subject: [PATCH] don't log tracebacks for expected download errors --- lbry/lbry/stream/stream_manager.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lbry/lbry/stream/stream_manager.py b/lbry/lbry/stream/stream_manager.py index b38ab0a97..8ac934664 100644 --- a/lbry/lbry/stream/stream_manager.py +++ b/lbry/lbry/stream/stream_manager.py @@ -6,8 +6,8 @@ import random import typing from typing import Optional from aiohttp.web import Request -from lbry.error import ResolveError, InvalidStreamDescriptorError -from lbry.error import ResolveTimeoutError, DownloadDataTimeoutError +from lbry.error import ResolveError, InvalidStreamDescriptorError, DownloadSDTimeoutError, InsufficientFundsError +from lbry.error import ResolveTimeoutError, DownloadDataTimeoutError, KeyFeeAboveMaxAllowedError from lbry.utils import cache_concurrent from lbry.stream.descriptor import StreamDescriptor from lbry.stream.managed_stream import ManagedStream @@ -440,7 +440,14 @@ class StreamManager: error = DownloadDataTimeoutError(stream.sd_hash) raise error except Exception as err: # forgive data timeout, don't delete stream - log.exception("Unexpected error downloading stream:") + expected = (DownloadSDTimeoutError, DownloadDataTimeoutError, InsufficientFundsError, + KeyFeeAboveMaxAllowedError) + if isinstance(err, expected): + log.warning("Failed to download %s: %s", uri, str(err)) + elif isinstance(err, asyncio.CancelledError): + pass + else: + log.exception("Unexpected error downloading stream:") error = err raise finally: