1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00
svtplay-dl/lib/svtplay_dl/error.py
Olof Johansson 51c71aa1cb error: New exception, NoRequestedProtocols
This excpetion is thrown when the stream can't be accessed by any accepted
protocol (as decided by options.stream_prio).
2016-03-31 20:19:44 +02:00

39 lines
1.1 KiB
Python

# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
class UIException(Exception):
pass
class ServiceError(Exception):
pass
class NoRequestedProtocols(UIException):
"""
This excpetion is thrown when the service provides streams,
but not using any accepted protocol (as decided by
options.stream_prio).
"""
def __init__(self, requested, found):
"""
The constructor takes two mandatory parameters, requested
and found. Both should be lists. requested is the protocols
we want and found is the protocols that can be used to
access the stream.
"""
self.requested = requested
self.found = found
super(NoRequestedProtocols, self).__init__(
"None of the provided protocols (%s) are in "
"the current list of accepted protocols (%s)" % (
self.found, self.requested
)
)
def __repr__(self):
return "NoRequestedProtocols(requested=%s, found=%s)" % (
self.requested, self.found)