File: error.py

package info (click to toggle)
python-hdf4 0.11.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,328 kB
  • sloc: ansic: 9,252; python: 3,445; makefile: 192
file content (23 lines) | stat: -rw-r--r-- 612 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# $Id: error.py,v 1.1 2004-08-02 15:00:34 gosselin Exp $
# $Log: not supported by cvs2svn $

from . import hdfext as _C

# #################
# Error processing
# #################

class HDF4Error(Exception):
    """ An error from inside the HDF4 library.
    """

def _checkErr(procName, val, msg=""):

    if val is None or (not isinstance(val, str) and val < 0):
        #_C._HEprint();
        errCode = _C.HEvalue(1)
        if errCode != 0:
            err = "%s (%d): %s" % (procName, errCode, _C.HEstring(errCode))
        else:
            err = "%s : %s" % (procName, msg)
        raise HDF4Error(err)