root/umpa/branches/link-layer-integration/umit/umpa/utils/exceptions.py @ 5720

Revision 5720, 2.0 kB (checked in by kosma, 3 years ago)

UMPAPcapException: add UMPAPcapException class

Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright (C) 2008-2009 Adriano Monteiro Marques.
5#
6# Author: Bartosz SKOWRON <getxsick at gmail dot com>
7#
8# This library is free software; you can redistribute it and/or modify
9# it under the terms of the GNU Lesser General Public License as published
10# by the Free Software Foundation; either version 2.1 of the License, or
11# (at your option) any later version.
12#
13# This library is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16# License for more details.
17#
18# You should have received a copy of the GNU Lesser General Public License
19# along with this library; if not, write to the Free Software Foundation,
20# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22"""
23Internal Exceptions for the library.
24"""
25
26class UMPAException(Exception):
27    """
28    General Exception.
29    """
30
31    def __init__(self, msg):
32        self.msg = msg
33    def __str__(self):
34        return repr(self.msg)
35
36class UMPAAttributeException(UMPAException):
37    """
38    Exception related to attributes issues.
39
40    It's being used if someone try to acces to undefined field etc.
41    """
42
43    pass
44
45class UMPAStrictException(UMPAException):
46    """
47    Exception related to strict packets issue.
48
49    If strict attribute of the Packet's object is True and
50    the order of protocols is odd then the exception is raised.
51    """
52
53    pass
54
55class UMPANotPermittedException(UMPAException):
56    """
57    Exception related to system permissions issues."
58    """
59
60    def __str__(self):
61        return repr(self.msg) + ("\n\tIt's recommended to use "
62                    "umit.umpa.utils.security module to avoid the exception.")
63
64class UMPASniffingException(UMPAException):
65    """
66    Exception related to sniffing feature.
67    """
68
69    pass
70
71class UMPAPcapException(UMPAException):
72    """
73    Exception related to libpcap support. Raised by umit.umpa.utils.libpcap.
74    """
75
76    pass
Note: See TracBrowser for help on using the browser.