How to use the cup.jenkinslib.internal.exception.Error function in cup

To help you get started, we’ve selected a few cup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github baidu / CUP / cup / jenkinslib / internal / exception.py View on Github external
class ImappropriateMethod(Error):
    """Method is imappropriate."""
    pass


class ImappropriateMethodInStaticMode(ImappropriateMethod):
    """Method should not be called in static mode."""
    pass


class NotImplementedMethod(NotImplementedError, ImappropriateMethod):
    """Method is not implemented."""
    pass


class OSIOError(OSError, IOError, Error):
    """OS or IO errors."""
    pass


class RequestError(OSIOError):
    """Something error while access jenkins."""
    def __init__(self, url, method=None, status=None, msg=None, err=None, response=None):
        self.url = url
        self.method = method
        self.status = status
        self.msg = msg
        self.err = err
        self.response = response

    def __str__(self):
        err_msg = ""
github baidu / CUP / cup / jenkinslib / internal / exception.py View on Github external
class ParamTypeError(TypeError, BadParam):
    """Param type is error."""
    pass


class BadValue(ValueError, Error):
    """Value is error."""
    pass


class RunTimeout(RuntimeError, Error):
    """Run timeout."""
    pass


class NotFound(Error):
    """Resource not found."""
    pass


class UnknownNode(KeyError, NotFound):
    """Node not found."""
    pass


class UnknownJob(KeyError, NotFound):
    """Job not found."""
    pass


class UnknownPromotion(KeyError, NotFound):
    """Promotion not found."""
github baidu / CUP / cup / jenkinslib / internal / base.py View on Github external
return ast.literal_eval(response.text)
        except Exception:
            pass

        # replace invalid chars
        api_info = response.text
        for char in INVALID_CHARS:
            if char in api_info:
                api_info = api_info.replace(char, '')

        # parse api info again
        try:
            return ast.literal_eval(api_info)
        except Exception:
            logging.exception('Inappropriate content found at %s', url)
            raise exception.Error('Cannot parse %s' % response.content)
github baidu / CUP / cup / jenkinslib / internal / exception.py View on Github external
Authors: liushuxian(liushuxian@baidu.com)
Date:    2015/01/20
""" 


class Error(Exception):
    """Base exception of jenkins module."""
    pass


class NotRunningOnJenkins(Error):
    """Cueent environment is not on jenkins slave node."""
    pass


class BadParam(Error):
    """Inappropriate params."""
    pass


class ParamTypeError(TypeError, BadParam):
    """Param type is error."""
    pass


class BadValue(ValueError, Error):
    """Value is error."""
    pass


class RunTimeout(RuntimeError, Error):
    """Run timeout."""
github baidu / CUP / cup / jenkinslib / internal / exception.py View on Github external
class BadParam(Error):
    """Inappropriate params."""
    pass


class ParamTypeError(TypeError, BadParam):
    """Param type is error."""
    pass


class BadValue(ValueError, Error):
    """Value is error."""
    pass


class RunTimeout(RuntimeError, Error):
    """Run timeout."""
    pass


class NotFound(Error):
    """Resource not found."""
    pass


class UnknownNode(KeyError, NotFound):
    """Node not found."""
    pass


class UnknownJob(KeyError, NotFound):
    """Job not found."""
github baidu / CUP / cup / jenkinslib / internal / exception.py View on Github external
class NoArtifacts(KeyError, NotFound):
    """Artifacts data not exist."""


class JenkinsAPIError(Error):
    """something wrong with jenkins api."""
    pass


class UnsupportedAPI(NotFound, JenkinsAPIError):
    """Jenkins api not supported on this jenkens server version."""
    pass


class NotStopYet(RuntimeError, Error):
    """Task still running, not stopped yet."""
    pass


class ImappropriateMethod(Error):
    """Method is imappropriate."""
    pass


class ImappropriateMethodInStaticMode(ImappropriateMethod):
    """Method should not be called in static mode."""
    pass


class NotImplementedMethod(NotImplementedError, ImappropriateMethod):
    """Method is not implemented."""
github baidu / CUP / cup / jenkinslib / internal / exception.py View on Github external
#
################################################################################
"""
This module defines all excptions of this project.

Authors: liushuxian(liushuxian@baidu.com)
Date:    2015/01/20
""" 


class Error(Exception):
    """Base exception of jenkins module."""
    pass


class NotRunningOnJenkins(Error):
    """Cueent environment is not on jenkins slave node."""
    pass


class BadParam(Error):
    """Inappropriate params."""
    pass


class ParamTypeError(TypeError, BadParam):
    """Param type is error."""
    pass


class BadValue(ValueError, Error):
    """Value is error."""
github baidu / CUP / cup / jenkinslib / __init__.py View on Github external
with build.ftp_artifacts as af:
        af['artifacts_path'].download('./local_path')
"""

import os
from cup.jenkinslib import internal
from cup.jenkinslib.internal import exception as _exception
from cup.jenkinslib.internal import jenkins as _jenkins
from cup.jenkinslib.internal import promotion as _promotion

# import Jenkins and Promotion
Jenkins = _jenkins.Jenkins
Promotion = _promotion.Promotion

# import exceptions
Error = _exception.Error
NotRunningOnJenkins = _exception.NotRunningOnJenkins
BadParam = _exception.BadParam
ParamTypeError = _exception.ParamTypeError
BadValue = _exception.BadValue
RunTimeout = _exception.RunTimeout
NotFound = _exception.NotFound
UnknownNode = _exception.UnknownNode
UnknownJob = _exception.UnknownJob
UnknownPromotion = _exception.UnknownPromotion
UnknownQueueItem = _exception.UnknownQueueItem
NotBuiltYet = _exception.NotBuiltYet
NoBuildData = _exception.NoBuildData
DeletedBuild = _exception.DeletedBuild
NoArtifacts = _exception.NoArtifacts
JenkinsAPIError = _exception.JenkinsAPIError
UnsupportedAPI = _exception.UnsupportedAPI