api_errors.py 文件源码

python
阅读 47 收藏 0 点赞 0 评论 0

项目:solaris-ips 作者: oracle 项目源码 文件源码
def _convert_error(e, ignored_errors=EmptyI):
        """Converts the provided exception into an ApiException equivalent if
        possible.  Returns a new exception object if converted or the original
        if not.

        'ignored_errors' is an optional list of errno values for which None
        should be returned.
        """

        if not hasattr(e, "errno"):
                return e
        if e.errno in ignored_errors:
                return None
        if e.errno in (errno.EACCES, errno.EPERM):
                return PermissionsException(e.filename)
        if e.errno == errno.EROFS:
                return ReadOnlyFileSystemException(e.filename)
        return e
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号