2014-03-10 01:18:05 -04:00
|
|
|
# Author: Nic Wolfe <nic@wolfeden.ca>
|
|
|
|
# URL: http://code.google.com/p/sickbeard/
|
|
|
|
#
|
2014-05-23 08:37:22 -04:00
|
|
|
# This file is part of SickRage.
|
2014-03-10 01:18:05 -04:00
|
|
|
#
|
2014-05-23 08:37:22 -04:00
|
|
|
# SickRage is free software: you can redistribute it and/or modify
|
2014-03-10 01:18:05 -04:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
2014-05-23 08:37:22 -04:00
|
|
|
# SickRage is distributed in the hope that it will be useful,
|
2014-03-10 01:18:05 -04:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2014-05-23 08:37:22 -04:00
|
|
|
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
from sickbeard.encodingKludge import fixStupidEncodings
|
|
|
|
|
2014-05-26 02:29:22 -04:00
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
def ex(e):
|
2014-03-20 04:15:22 -04:00
|
|
|
"""
|
|
|
|
Returns a unicode string from the exception text if it exists.
|
|
|
|
"""
|
|
|
|
|
|
|
|
e_message = u""
|
|
|
|
|
|
|
|
if not e or not e.args:
|
|
|
|
return e_message
|
|
|
|
|
|
|
|
for arg in e.args:
|
|
|
|
|
|
|
|
if arg is not None:
|
|
|
|
if isinstance(arg, (str, unicode)):
|
|
|
|
fixed_arg = fixStupidEncodings(arg, True)
|
|
|
|
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
fixed_arg = u"error " + fixStupidEncodings(str(arg), True)
|
|
|
|
|
|
|
|
except:
|
|
|
|
fixed_arg = None
|
|
|
|
|
|
|
|
if fixed_arg:
|
|
|
|
if not e_message:
|
|
|
|
e_message = fixed_arg
|
|
|
|
|
|
|
|
else:
|
|
|
|
e_message = e_message + " : " + fixed_arg
|
|
|
|
|
|
|
|
return e_message
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class SickBeardException(Exception):
|
2014-05-23 08:37:22 -04:00
|
|
|
"Generic SickRage Exception - should never be thrown, only subclassed"
|
2014-03-20 04:15:22 -04:00
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class ConfigErrorException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Error in the config file"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class LaterException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Something bad happened that I'll make a real exception for later"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class NoNFOException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"No NFO was found!"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class NoShowDirException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Unable to find the show's directory"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class FileNotFoundException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"The specified file doesn't exist"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class MultipleDBEpisodesException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Found multiple episodes in the DB! Must fix DB first"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class MultipleDBShowsException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Found multiple shows in the DB! Must fix DB first"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class MultipleShowObjectsException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Found multiple objects for the same show! Something is very wrong"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class WrongShowException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"The episode doesn't belong to the same show as its parent folder"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class ShowNotFoundException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"The show wasn't found on the Indexer"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class EpisodeNotFoundException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"The episode wasn't found on the Indexer"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class NewzbinAPIThrottled(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Newzbin has throttled us, deal with it"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class ShowDirNotFoundException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"The show dir doesn't exist"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class AuthException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Your authentication information is incorrect"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class EpisodeDeletedException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"This episode has been deleted"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class CantRefreshException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"The show can't be refreshed right now"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class CantUpdateException(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"The show can't be updated right now"
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
class PostProcessingFailed(SickBeardException):
|
2014-03-20 04:15:22 -04:00
|
|
|
"Post-processing the episode failed"
|
|
|
|
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
class FailedProcessingFailed(SickBeardException):
|
|
|
|
"Post-processing the failed release failed"
|
|
|
|
|
2014-03-20 04:15:22 -04:00
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
class FailedHistoryMultiSnatchException(SickBeardException):
|
|
|
|
"Episode was snatched again before the first one was done"
|
|
|
|
|
2014-03-20 04:15:22 -04:00
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
class FailedHistoryNotFoundException(SickBeardException):
|
2014-05-26 02:29:22 -04:00
|
|
|
"The release was not found in the failed download history tracker"
|
|
|
|
|
|
|
|
|
|
|
|
class EpisodeNotFoundByAbsoluteNumberException(SickBeardException):
|
|
|
|
"The show wasn't found in the DB while looking at Absolute Numbers"
|