From a7543eef944feaadbd9b752d3a0a23863623947c Mon Sep 17 00:00:00 2001 From: Salim Fadhley Date: Sun, 3 Aug 2014 21:01:35 +0100 Subject: [PATCH] Tidy up exceptions file. --- jenkinsapi/custom_exceptions.py | 84 +++++++++------------------------ 1 file changed, 23 insertions(+), 61 deletions(-) diff --git a/jenkinsapi/custom_exceptions.py b/jenkinsapi/custom_exceptions.py index 5582900..4573cd7 100644 --- a/jenkinsapi/custom_exceptions.py +++ b/jenkinsapi/custom_exceptions.py @@ -1,137 +1,107 @@ -""" -Module for custom_exceptions specialized for jenkinsapi +"""Module for custom_exceptions. + +Where possible we try to throw exceptions with non-generic, +meaningful names. """ class JenkinsAPIException(Exception): - - """ - Base class for all errors + """Base class for all errors """ pass class NotFound(JenkinsAPIException): - - """ - Resource cannot be found + """Resource cannot be found """ pass class ArtifactsMissing(NotFound): - - """ - Cannot find a build with all of the required artifacts. + """Cannot find a build with all of the required artifacts. """ pass class UnknownJob(KeyError, NotFound): - - """ - Jenkins does not recognize the job requested. + """Jenkins does not recognize the job requested. """ pass class UnknownView(KeyError, NotFound): - - """ - Jenkins does not recognize the view requested. + """Jenkins does not recognize the view requested. """ pass class UnknownNode(KeyError, NotFound): - - """ - Jenkins does not recognize the node requested. + """Jenkins does not recognize the node requested. """ pass class UnknownQueueItem(KeyError, NotFound): - - """ - Jenkins does not recognize the requested queue item + """Jenkins does not recognize the requested queue item """ pass class UnknownPlugin(KeyError, NotFound): - - """ - Jenkins does not recognize the plugin requested. + """Jenkins does not recognize the plugin requested. """ pass class NoBuildData(NotFound): - - """ - A job has no build data. + """A job has no build data. """ pass class NotBuiltYet(NotFound): - - """ - A job has no build data. + """A job has no build data. """ pass class ArtifactBroken(JenkinsAPIException): - - """ - An artifact is broken, wrong + """An artifact is broken, wrong """ pass class TimeOut(JenkinsAPIException): - - """ - Some jobs have taken too long to complete. + """Some jobs have taken too long to complete. """ pass class NoResults(JenkinsAPIException): - - """ - A build did not publish any results. + """A build did not publish any results. """ pass class FailedNoResults(NoResults): - - """ - A build did not publish any results because it failed + """A build did not publish any results because it failed """ pass class BadURL(ValueError, JenkinsAPIException): - - """ - A URL appears to be broken + """A URL appears to be broken """ pass class NotAuthorized(JenkinsAPIException): - """Not Authorized to access resource""" # Usually thrown when we get a 403 returned pass class NotSupportSCM(JenkinsAPIException): - """ It's a SCM that does not supported by current version of jenkinsapi """ @@ -139,32 +109,24 @@ class NotSupportSCM(JenkinsAPIException): class NotConfiguredSCM(JenkinsAPIException): - - """ - It's a job that doesn't have configured SCM + """It's a job that doesn't have configured SCM """ pass class NotInQueue(JenkinsAPIException): - - """ - It's a job that is not in the queue + """It's a job that is not in the queue """ pass class PostRequired(JenkinsAPIException): - - """ - Method requires POST and not GET + """Method requires POST and not GET """ pass class BadParams(JenkinsAPIException): - - """ - Invocation was given bad or inappropriate params + """Invocation was given bad or inappropriate params """ pass -- 2.34.1