Skip to main content

hdf5_metno/
error_codes.rs

1//! Major and minor error codes reported by the HDF5 library.
2//!
3//! Each [`ErrorFrame`](crate::ErrorFrame) carries a major code for which part of the library
4//! failed and a minor code for how it failed. HDF5 assigns these ids at runtime, so this module
5//! resolves them into enums that can be matched.
6//!
7//! Variants are not gated on the HDF5 version, so naming one never requires a `#[cfg]`. A code
8//! the linked HDF5 does not define is never returned by `from_id`, and a code this crate does
9//! not know becomes `Other`.
10//!
11//! Codes HDF5 renamed (but kept for backwards compatibility) map to one variant, so a match works on any
12//! version: [`MinorErrorCode::BadId`] resolves from `H5E_BADID` or `H5E_BADATOM`, and
13//! [`MinorErrorCode::Logging`] from `H5E_LOGGING` or `H5E_LOGFAIL`.
14//!
15//! Names, descriptions and version gates come from HDF5's [`H5err.txt`], which generates the
16//! `H5E_*_g` symbols. To check a gate, diff that file between two release tags, e.g.
17//! `hdf5-1_10_2` (no `H5E_CONTEXT`) against `hdf5-1_10_3` (has it). The [user guide] describes
18//! major and minor codes.
19//!
20//! [`H5err.txt`]: https://github.com/HDFGroup/hdf5/blob/hdf5_2.1.0/src/H5err.txt
21//! [user guide]: https://support.hdfgroup.org/documentation/hdf5/latest/_h5_e__u_g.html
22//!
23//! # Example
24//!
25//! ```no_run
26//! use hdf5_metno as hdf5;
27//! use hdf5::MinorErrorCode;
28//!
29//! # let dir = tempfile::tempdir().unwrap();
30//! # let path = dir.path().join("corrupt.h5");
31//! # std::fs::write(&path, b"definitely not an HDF5 file").unwrap();
32//! match hdf5::File::open(&path) {
33//!     Err(err) if err.contains_minor(MinorErrorCode::NotHdf5) => {
34//!         // the file exists but its superblock is unreadable
35//!     }
36//!     _ => {}
37//! }
38//! ```
39
40use std::collections::HashMap;
41use std::fmt::{self, Display};
42use std::sync::LazyLock;
43
44use hdf5_sys::h5i::hid_t;
45
46use crate::globals::*;
47
48/// Defines an error-code enum from three lists:
49///
50/// - `variants`: the enum body, never gated (no need for `#[cfg]` downstream).
51/// - `symbols`: `hid_t` to variant, gated on the version introducing the symbol. Renamed codes
52///   contribute one entry per spelling.
53/// - `meta`: variant to C identifier and description. Gated only for renamed codes, where the
54///   arms must be mutually exclusive and total.
55macro_rules! error_codes {
56    (
57        $(#[$emeta:meta])*
58        $name:ident, $table:ident;
59
60        variants { $( $(#[$vdoc:meta])* $variant:ident, )* }
61        symbols { $( $([$scfg:meta])? $global:ident => $svariant:ident, )* }
62        meta { $( $([$mcfg:meta])? $mvariant:ident => ($cname:literal, $desc:literal), )* }
63    ) => {
64        $(#[$emeta])*
65        #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
66        #[non_exhaustive]
67        pub enum $name {
68            $(
69                $(#[$vdoc])*
70                $variant,
71            )*
72            /// A code reported by HDF5 that this crate does not know.
73            ///
74            /// The raw message id is only valid for the lifetime of the process.
75            Other(hid_t),
76        }
77
78        // Initialised from inside `h5lock`, which is only safe because `sync` forces
79        // `LIBRARY_INIT` before taking `LOCK`, so dereferencing the globals below cannot
80        // reach for the lock a second time.
81        pub(crate) static $table: LazyLock<HashMap<hid_t, $name>> = LazyLock::new(|| {
82            let mut map = HashMap::new();
83            $(
84                $(#[cfg($scfg)])?
85                map.insert(*$global, $name::$svariant);
86            )*
87            map
88        });
89
90        impl $name {
91            /// Resolves a raw HDF5 message id, or [`Other`](Self::Other) if unknown.
92            #[must_use]
93            pub fn from_id(id: hid_t) -> Self {
94                $table.get(&id).copied().unwrap_or(Self::Other(id))
95            }
96
97            /// The C identifier, e.g. `"H5E_CANTOPENFILE"`, as spelled by the linked HDF5.
98            ///
99            /// `None` only for [`Other`](Self::Other).
100            #[must_use]
101            pub fn name(self) -> Option<&'static str> {
102                match self {
103                    $( $(#[cfg($mcfg)])? Self::$mvariant => Some($cname), )*
104                    Self::Other(_) => None,
105                }
106            }
107
108            /// The description HDF5 documents for this code, as worded by the linked HDF5.
109            ///
110            /// `None` only for [`Other`](Self::Other).
111            #[must_use]
112            pub fn description(self) -> Option<&'static str> {
113                match self {
114                    $( $(#[cfg($mcfg)])? Self::$mvariant => Some($desc), )*
115                    Self::Other(_) => None,
116                }
117            }
118
119            /// Every code this crate knows, including any the linked HDF5 cannot report.
120            #[must_use]
121            pub fn all() -> &'static [Self] {
122                &[ $( Self::$variant, )* ]
123            }
124        }
125
126        impl Display for $name {
127            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
128                match *self {
129                    Self::Other(id) => write!(f, "unknown error code ({id})"),
130                    ref code => f.write_str(code.description().unwrap_or("unknown error code")),
131                }
132            }
133        }
134    };
135}
136
137error_codes! {
138    /// The major error code of an HDF5 error frame.
139    MajorErrorCode, MAJOR_CODES;
140
141    variants {
142        /// `H5E_ARGS`: Invalid arguments to routine
143        Args,
144        /// `H5E_ATTR`: Attribute
145        Attr,
146        /// `H5E_BTREE`: B-Tree node
147        BTree,
148        /// `H5E_CACHE`: Object cache
149        Cache,
150        /// `H5E_CONTEXT`: API Context
151        Context,
152        /// `H5E_DATASET`: Dataset
153        Dataset,
154        /// `H5E_DATASPACE`: Dataspace
155        Dataspace,
156        /// `H5E_DATATYPE`: Datatype
157        Datatype,
158        /// `H5E_ERROR`: Error API
159        ErrorApi,
160        /// `H5E_EVENTSET`: Event Set
161        EventSet,
162        /// `H5E_EARRAY`: Extensible Array
163        ExtensibleArray,
164        /// `H5E_EFL`: External file list
165        ExternalFileList,
166        /// `H5E_FILE`: File accessibility
167        File,
168        /// `H5E_FARRAY`: Fixed Array
169        FixedArray,
170        /// `H5E_FSPACE`: Free Space Manager
171        FreeSpace,
172        /// `H5E_FUNC`: Function entry/exit
173        Func,
174        /// `H5E_HEAP`: Heap
175        Heap,
176        /// `H5E_ID` (`H5E_ATOM` in older HDF5): Object ID
177        Id,
178        /// `H5E_INTERNAL`: Internal error (too specific to document in detail)
179        Internal,
180        /// `H5E_IO`: Low-level I/O
181        Io,
182        /// `H5E_LIB`: General library infrastructure
183        Lib,
184        /// `H5E_LINK`: Links
185        Link,
186        /// `H5E_MAP`: Map
187        Map,
188        /// `H5E_NONE_MAJOR`: No error
189        NoneMajor,
190        /// `H5E_OHDR`: Object header
191        ObjectHeader,
192        /// `H5E_PAGEBUF`: Page Buffering
193        PageBuffering,
194        /// `H5E_PLINE`: Data filters
195        Pipeline,
196        /// `H5E_PLUGIN`: Plugin for dynamically loaded library
197        Plugin,
198        /// `H5E_PLIST`: Property lists
199        PropertyList,
200        /// `H5E_RTREE`: R-Tree spatial index
201        RTree,
202        /// `H5E_RS`: Reference Counted Strings
203        RefCountedString,
204        /// `H5E_REFERENCE`: References
205        Reference,
206        /// `H5E_RESOURCE`: Resource unavailable
207        Resource,
208        /// `H5E_SOHM`: Shared Object Header Messages
209        SharedObjectHeaderMessage,
210        /// `H5E_SLIST`: Skip Lists
211        SkipList,
212        /// `H5E_STORAGE`: Data storage
213        Storage,
214        /// `H5E_SYM`: Symbol table
215        SymbolTable,
216        /// `H5E_TST`: Ternary Search Trees
217        TernarySearchTree,
218        /// `H5E_THREADSAFE`: Threadsafety
219        Threadsafety,
220        /// `H5E_VFL`: Virtual File Layer
221        VirtualFileLayer,
222        /// `H5E_VOL`: Virtual Object Layer
223        VirtualObjectLayer,
224    }
225
226    symbols {
227        H5E_ARGS => Args,
228        H5E_ATTR => Attr,
229        H5E_BTREE => BTree,
230        H5E_CACHE => Cache,
231        [feature = "1.10.3"] H5E_CONTEXT => Context,
232        H5E_DATASET => Dataset,
233        H5E_DATASPACE => Dataspace,
234        H5E_DATATYPE => Datatype,
235        H5E_ERROR => ErrorApi,
236        [feature = "1.14.0"] H5E_EVENTSET => EventSet,
237        [feature = "1.10.0"] H5E_EARRAY => ExtensibleArray,
238        H5E_EFL => ExternalFileList,
239        H5E_FILE => File,
240        [feature = "1.10.0"] H5E_FARRAY => FixedArray,
241        H5E_FSPACE => FreeSpace,
242        H5E_FUNC => Func,
243        H5E_HEAP => Heap,
244        [not(feature = "1.14.0")] H5E_ATOM => Id,
245        [feature = "1.14.0"] H5E_ID => Id,
246        H5E_INTERNAL => Internal,
247        H5E_IO => Io,
248        [feature = "1.12.1"] H5E_LIB => Lib,
249        H5E_LINK => Link,
250        [feature = "1.12.0"] H5E_MAP => Map,
251        H5E_NONE_MAJOR => NoneMajor,
252        H5E_OHDR => ObjectHeader,
253        [feature = "1.10.1"] H5E_PAGEBUF => PageBuffering,
254        H5E_PLINE => Pipeline,
255        [feature = "1.8.11"] H5E_PLUGIN => Plugin,
256        H5E_PLIST => PropertyList,
257        [feature = "2.0.0"] H5E_RTREE => RTree,
258        H5E_RS => RefCountedString,
259        H5E_REFERENCE => Reference,
260        H5E_RESOURCE => Resource,
261        H5E_SOHM => SharedObjectHeaderMessage,
262        H5E_SLIST => SkipList,
263        H5E_STORAGE => Storage,
264        H5E_SYM => SymbolTable,
265        H5E_TST => TernarySearchTree,
266        [feature = "2.0.0"] H5E_THREADSAFE => Threadsafety,
267        H5E_VFL => VirtualFileLayer,
268        [feature = "1.12.0"] H5E_VOL => VirtualObjectLayer,
269    }
270
271    meta {
272        Args => ("H5E_ARGS", "Invalid arguments to routine"),
273        Attr => ("H5E_ATTR", "Attribute"),
274        BTree => ("H5E_BTREE", "B-Tree node"),
275        Cache => ("H5E_CACHE", "Object cache"),
276        Context => ("H5E_CONTEXT", "API Context"),
277        Dataset => ("H5E_DATASET", "Dataset"),
278        Dataspace => ("H5E_DATASPACE", "Dataspace"),
279        Datatype => ("H5E_DATATYPE", "Datatype"),
280        ErrorApi => ("H5E_ERROR", "Error API"),
281        EventSet => ("H5E_EVENTSET", "Event Set"),
282        ExtensibleArray => ("H5E_EARRAY", "Extensible Array"),
283        ExternalFileList => ("H5E_EFL", "External file list"),
284        File => ("H5E_FILE", "File accessibility"),
285        FixedArray => ("H5E_FARRAY", "Fixed Array"),
286        FreeSpace => ("H5E_FSPACE", "Free Space Manager"),
287        Func => ("H5E_FUNC", "Function entry/exit"),
288        Heap => ("H5E_HEAP", "Heap"),
289        [feature = "1.14.0"] Id => ("H5E_ID", "Object ID"),
290        [not(feature = "1.14.0")] Id => ("H5E_ATOM", "Object atom"),
291        Internal => ("H5E_INTERNAL", "Internal error (too specific to document in detail)"),
292        Io => ("H5E_IO", "Low-level I/O"),
293        Lib => ("H5E_LIB", "General library infrastructure"),
294        Link => ("H5E_LINK", "Links"),
295        Map => ("H5E_MAP", "Map"),
296        NoneMajor => ("H5E_NONE_MAJOR", "No error"),
297        ObjectHeader => ("H5E_OHDR", "Object header"),
298        PageBuffering => ("H5E_PAGEBUF", "Page Buffering"),
299        Pipeline => ("H5E_PLINE", "Data filters"),
300        Plugin => ("H5E_PLUGIN", "Plugin for dynamically loaded library"),
301        PropertyList => ("H5E_PLIST", "Property lists"),
302        RTree => ("H5E_RTREE", "R-Tree spatial index"),
303        RefCountedString => ("H5E_RS", "Reference Counted Strings"),
304        Reference => ("H5E_REFERENCE", "References"),
305        Resource => ("H5E_RESOURCE", "Resource unavailable"),
306        SharedObjectHeaderMessage => ("H5E_SOHM", "Shared Object Header Messages"),
307        SkipList => ("H5E_SLIST", "Skip Lists"),
308        Storage => ("H5E_STORAGE", "Data storage"),
309        SymbolTable => ("H5E_SYM", "Symbol table"),
310        TernarySearchTree => ("H5E_TST", "Ternary Search Trees"),
311        Threadsafety => ("H5E_THREADSAFE", "Threadsafety"),
312        VirtualFileLayer => ("H5E_VFL", "Virtual File Layer"),
313        VirtualObjectLayer => ("H5E_VOL", "Virtual Object Layer"),
314    }
315}
316
317error_codes! {
318    /// The minor error code of an HDF5 error frame.
319    MinorErrorCode, MINOR_CODES;
320
321    variants {
322        /// `H5E_ALIGNMENT`: Alignment error
323        Alignment,
324        /// `H5E_ALREADYEXISTS`: Object already exists
325        AlreadyExists,
326        /// `H5E_ALREADYINIT`: Object already initialized
327        AlreadyInit,
328        /// `H5E_BADFILE`: Bad file ID accessed
329        BadFile,
330        /// `H5E_BADGROUP`: Unable to find ID group information
331        BadGroup,
332        /// `H5E_BADID` (`H5E_BADATOM` in older HDF5): Unable to find ID information (already closed?)
333        BadId,
334        /// `H5E_BADITER`: Iteration failed
335        BadIter,
336        /// `H5E_BADMESG`: Unrecognized message
337        BadMessage,
338        /// `H5E_BADRANGE`: Out of range
339        BadRange,
340        /// `H5E_BADSELECT`: Invalid selection
341        BadSelect,
342        /// `H5E_BADSIZE`: Bad size for object
343        BadSize,
344        /// `H5E_BADTYPE`: Inappropriate type
345        BadType,
346        /// `H5E_BADVALUE`: Bad value
347        BadValue,
348        /// `H5E_CALLBACK`: Callback failed
349        Callback,
350        /// `H5E_CANAPPLY`: Error from filter 'can apply' callback
351        CanApply,
352        /// `H5E_CANTALLOC`: Can't allocate space
353        CantAlloc,
354        /// `H5E_CANTAPPEND`: Can't append object
355        CantAppend,
356        /// `H5E_CANTATTACH`: Can't attach object
357        CantAttach,
358        /// `H5E_CANTCANCEL`: Can't cancel operation
359        CantCancel,
360        /// `H5E_CANTCLEAN`: Unable to mark metadata as clean
361        CantClean,
362        /// `H5E_CANTCLIP`: Can't clip hyperslab region
363        CantClip,
364        /// `H5E_CANTCLOSEFILE`: Unable to close file
365        CantCloseFile,
366        /// `H5E_CANTCLOSEOBJ`: Can't close object
367        CantCloseObj,
368        /// `H5E_CANTCOMPARE`: Can't compare objects
369        CantCompare,
370        /// `H5E_CANTCOMPUTE`: Can't compute value
371        CantCompute,
372        /// `H5E_CANTCONVERT`: Can't convert datatypes
373        CantConvert,
374        /// `H5E_CANTCOPY`: Unable to copy object
375        CantCopy,
376        /// `H5E_CANTCORK`: Unable to cork an object
377        CantCork,
378        /// `H5E_CANTCOUNT`: Can't count elements
379        CantCount,
380        /// `H5E_CANTCREATE`: Unable to create file
381        CantCreate,
382        /// `H5E_CANTDEC`: Unable to decrement reference count
383        CantDec,
384        /// `H5E_CANTDECODE`: Unable to decode value
385        CantDecode,
386        /// `H5E_CANTDELETE`: Can't delete message
387        CantDelete,
388        /// `H5E_CANTDELETEFILE`: Unable to delete file
389        CantDeleteFile,
390        /// `H5E_CANTDEPEND`: Unable to create a flush dependency
391        CantDepend,
392        /// `H5E_CANTDIRTY`: Unable to mark metadata as dirty
393        CantDirty,
394        /// `H5E_CANTENCODE`: Unable to encode value
395        CantEncode,
396        /// `H5E_CANTEXPUNGE`: Unable to expunge a metadata cache entry
397        CantExpunge,
398        /// `H5E_CANTEXTEND`: Can't extend heap's space
399        CantExtend,
400        /// `H5E_CANTFILTER`: Filter operation failed
401        CantFilter,
402        /// `H5E_CANTFIND`: Unable to check for record
403        CantFind,
404        /// `H5E_CANTFLUSH`: Unable to flush data from cache
405        CantFlush,
406        /// `H5E_CANTFREE`: Unable to free object
407        CantFree,
408        /// `H5E_CANTGATHER`: Can't gather data
409        CantGather,
410        /// `H5E_CANTGC`: Unable to garbage collect
411        CantGc,
412        /// `H5E_CANTGET`: Can't get value
413        CantGet,
414        /// `H5E_CANTGETSIZE`: Unable to compute size
415        CantGetSize,
416        /// `H5E_CANTINC`: Unable to increment reference count
417        CantInc,
418        /// `H5E_CANTINIT`: Unable to initialize object
419        CantInit,
420        /// `H5E_CANTINS`: Unable to insert metadata into cache
421        CantIns,
422        /// `H5E_CANTINSERT`: Unable to insert object
423        CantInsert,
424        /// `H5E_CANTLIST`: Unable to list node
425        CantList,
426        /// `H5E_CANTLOAD`: Unable to load metadata into cache
427        CantLoad,
428        /// `H5E_CANTLOCK`: Unable to lock object
429        CantLock,
430        /// `H5E_CANTLOCKFILE`: Unable to lock file
431        CantLockFile,
432        /// `H5E_CANTMARKCLEAN`: Unable to mark a pinned entry as clean
433        CantMarkClean,
434        /// `H5E_CANTMARKDIRTY`: Unable to mark a pinned entry as dirty
435        CantMarkDirty,
436        /// `H5E_CANTMARKSERIALIZED`: Unable to mark an entry as serialized
437        CantMarkSerialized,
438        /// `H5E_CANTMARKUNSERIALIZED`: Unable to mark an entry as unserialized
439        CantMarkUnserialized,
440        /// `H5E_CANTMERGE`: Can't merge objects
441        CantMerge,
442        /// `H5E_CANTMODIFY`: Unable to modify record
443        CantModify,
444        /// `H5E_CANTMOVE`: Can't move object
445        CantMove,
446        /// `H5E_CANTNEXT`: Can't move to next iterator location
447        CantNext,
448        /// `H5E_CANTNOTIFY`: Unable to notify object about action
449        CantNotify,
450        /// `H5E_CANTOPENFILE`: Unable to open file
451        CantOpenFile,
452        /// `H5E_CANTOPENOBJ`: Can't open object
453        CantOpenObj,
454        /// `H5E_CANTOPERATE`: Can't operate on object
455        CantOperate,
456        /// `H5E_CANTPACK`: Can't pack messages
457        CantPack,
458        /// `H5E_CANTPIN`: Unable to pin cache entry
459        CantPin,
460        /// `H5E_CANTPROTECT`: Unable to protect metadata
461        CantProtect,
462        /// `H5E_CANTPUT`: Can't put value
463        CantPut,
464        /// `H5E_CANTRECV`: Can't receive data
465        CantRecv,
466        /// `H5E_CANTREDISTRIBUTE`: Unable to redistribute records
467        CantRedistribute,
468        /// `H5E_CANTREGISTER`: Unable to register new ID
469        CantRegister,
470        /// `H5E_CANTRELEASE`: Unable to release object
471        CantRelease,
472        /// `H5E_CANTREMOVE`: Unable to remove object
473        CantRemove,
474        /// `H5E_CANTRENAME`: Unable to rename object
475        CantRename,
476        /// `H5E_CANTRESET`: Can't reset object
477        CantReset,
478        /// `H5E_CANTRESIZE`: Unable to resize a metadata cache entry
479        CantResize,
480        /// `H5E_CANTRESTORE`: Can't restore condition
481        CantRestore,
482        /// `H5E_CANTREVIVE`: Can't revive object
483        CantRevive,
484        /// `H5E_CANTSELECT`: Can't select hyperslab
485        CantSelect,
486        /// `H5E_CANTSERIALIZE`: Unable to serialize data from cache
487        CantSerialize,
488        /// `H5E_CANTSET`: Can't set value
489        CantSet,
490        /// `H5E_CANTSHRINK`: Can't shrink container
491        CantShrink,
492        /// `H5E_CANTSORT`: Can't sort objects
493        CantSort,
494        /// `H5E_CANTSPLIT`: Unable to split node
495        CantSplit,
496        /// `H5E_CANTSWAP`: Unable to swap records
497        CantSwap,
498        /// `H5E_CANTTAG`: Unable to tag metadata in the cache
499        CantTag,
500        /// `H5E_CANTUNCORK`: Unable to uncork an object
501        CantUncork,
502        /// `H5E_CANTUNDEPEND`: Unable to destroy a flush dependency
503        CantUndepend,
504        /// `H5E_CANTUNLOCK`: Unable to unlock object
505        CantUnlock,
506        /// `H5E_CANTUNLOCKFILE`: Unable to unlock file
507        CantUnlockFile,
508        /// `H5E_CANTUNPIN`: Unable to un-pin cache entry
509        CantUnpin,
510        /// `H5E_CANTUNPROTECT`: Unable to unprotect metadata
511        CantUnprotect,
512        /// `H5E_CANTUNSERIALIZE`: Unable to mark metadata as unserialized
513        CantUnserialize,
514        /// `H5E_CANTUPDATE`: Can't update object
515        CantUpdate,
516        /// `H5E_CANTWAIT`: Can't wait on operation
517        CantWait,
518        /// `H5E_CLOSEERROR`: Close failed
519        CloseError,
520        /// `H5E_COMPLEN`: Name component is too long
521        CompLen,
522        /// `H5E_DUPCLASS`: Duplicate class name in parent class
523        DupClass,
524        /// `H5E_EXISTS`: Object already exists
525        Exists,
526        /// `H5E_FCNTL`: File control (fcntl) failed
527        Fcntl,
528        /// `H5E_FILEEXISTS`: File already exists
529        FileExists,
530        /// `H5E_FILEOPEN`: File already open
531        FileOpen,
532        /// `H5E_INCONSISTENTSTATE`: Internal states are inconsistent
533        InconsistentState,
534        /// `H5E_LINKCOUNT`: Bad object header link count
535        LinkCount,
536        /// `H5E_LOGGING` (`H5E_LOGFAIL` in older HDF5): Failure in the cache logging framework
537        Logging,
538        /// `H5E_MOUNT`: File mount error
539        Mount,
540        /// `H5E_MPI`: Some MPI function failed
541        Mpi,
542        /// `H5E_MPIERRSTR`: MPI Error String
543        MpiErrStr,
544        /// `H5E_NLINKS`: Too many soft links in path
545        NLinks,
546        /// `H5E_NOENCODER`: Filter present but encoding disabled
547        NoEncoder,
548        /// `H5E_NOFILTER`: Requested filter is not available
549        NoFilter,
550        /// `H5E_NOIDS`: Out of IDs for group
551        NoIds,
552        /// `H5E_NO_INDEPENDENT`: Can't perform independent IO
553        NoIndependent,
554        /// `H5E_NOSPACE`: No space available for allocation
555        NoSpace,
556        /// `H5E_NONE_MINOR`: No error
557        NoneMinor,
558        /// `H5E_NOTCACHED`: Metadata not currently cached
559        NotCached,
560        /// `H5E_NOTFOUND`: Object not found
561        NotFound,
562        /// `H5E_NOTHDF5`: Not an HDF5 file
563        NotHdf5,
564        /// `H5E_NOTREGISTERED`: Link class not registered
565        NotRegistered,
566        /// `H5E_OBJOPEN`: Object is already open
567        ObjOpen,
568        /// `H5E_OPENERROR`: Can't open directory or file
569        OpenError,
570        /// `H5E_OVERFLOW`: Address overflowed
571        Overflow,
572        /// `H5E_PATH`: Problem with path to object
573        Path,
574        /// `H5E_PROTECT`: Protected metadata error
575        Protect,
576        /// `H5E_READERROR`: Read failed
577        ReadError,
578        /// `H5E_SEEKERROR`: Seek failed
579        SeekError,
580        /// `H5E_SETDISALLOWED`: Disallowed operation
581        SetDisallowed,
582        /// `H5E_SETLOCAL`: Error from filter 'set local' callback
583        SetLocal,
584        /// `H5E_SYSERRSTR`: System error message
585        SysErrStr,
586        /// `H5E_SYSTEM`: Internal error detected
587        System,
588        /// `H5E_TRAVERSE`: Link traversal failure
589        Traverse,
590        /// `H5E_TRUNCATED`: File has been truncated
591        Truncated,
592        /// `H5E_UNINITIALIZED`: Information is uinitialized
593        Uninitialized,
594        /// `H5E_UNMOUNT`: File unmount error
595        Unmount,
596        /// `H5E_UNSUPPORTED`: Feature is unsupported
597        Unsupported,
598        /// `H5E_VERSION`: Wrong version number
599        Version,
600        /// `H5E_WRITEERROR`: Write failed
601        WriteError,
602    }
603
604    symbols {
605        H5E_ALIGNMENT => Alignment,
606        H5E_ALREADYEXISTS => AlreadyExists,
607        H5E_ALREADYINIT => AlreadyInit,
608        H5E_BADFILE => BadFile,
609        H5E_BADGROUP => BadGroup,
610        [not(feature = "1.14.0")] H5E_BADATOM => BadId,
611        [feature = "1.14.0"] H5E_BADID => BadId,
612        H5E_BADITER => BadIter,
613        H5E_BADMESG => BadMessage,
614        H5E_BADRANGE => BadRange,
615        H5E_BADSELECT => BadSelect,
616        H5E_BADSIZE => BadSize,
617        H5E_BADTYPE => BadType,
618        H5E_BADVALUE => BadValue,
619        H5E_CALLBACK => Callback,
620        H5E_CANAPPLY => CanApply,
621        H5E_CANTALLOC => CantAlloc,
622        [feature = "1.10.0"] H5E_CANTAPPEND => CantAppend,
623        H5E_CANTATTACH => CantAttach,
624        [feature = "1.14.0"] H5E_CANTCANCEL => CantCancel,
625        [feature = "1.10.1"] H5E_CANTCLEAN => CantClean,
626        H5E_CANTCLIP => CantClip,
627        H5E_CANTCLOSEFILE => CantCloseFile,
628        H5E_CANTCLOSEOBJ => CantCloseObj,
629        H5E_CANTCOMPARE => CantCompare,
630        H5E_CANTCOMPUTE => CantCompute,
631        H5E_CANTCONVERT => CantConvert,
632        H5E_CANTCOPY => CantCopy,
633        [feature = "1.10.0"] H5E_CANTCORK => CantCork,
634        H5E_CANTCOUNT => CantCount,
635        H5E_CANTCREATE => CantCreate,
636        H5E_CANTDEC => CantDec,
637        H5E_CANTDECODE => CantDecode,
638        H5E_CANTDELETE => CantDelete,
639        [feature = "1.12.0"] H5E_CANTDELETEFILE => CantDeleteFile,
640        [feature = "1.10.0"] H5E_CANTDEPEND => CantDepend,
641        H5E_CANTDIRTY => CantDirty,
642        H5E_CANTENCODE => CantEncode,
643        H5E_CANTEXPUNGE => CantExpunge,
644        H5E_CANTEXTEND => CantExtend,
645        H5E_CANTFILTER => CantFilter,
646        [feature = "1.14.0"] H5E_CANTFIND => CantFind,
647        H5E_CANTFLUSH => CantFlush,
648        H5E_CANTFREE => CantFree,
649        [feature = "1.10.2"] H5E_CANTGATHER => CantGather,
650        H5E_CANTGC => CantGc,
651        H5E_CANTGET => CantGet,
652        H5E_CANTGETSIZE => CantGetSize,
653        H5E_CANTINC => CantInc,
654        H5E_CANTINIT => CantInit,
655        H5E_CANTINS => CantIns,
656        H5E_CANTINSERT => CantInsert,
657        H5E_CANTLIST => CantList,
658        H5E_CANTLOAD => CantLoad,
659        H5E_CANTLOCK => CantLock,
660        [any(all(feature = "1.10.7", not(feature = "1.12.0")), feature = "1.12.1")] H5E_CANTLOCKFILE => CantLockFile,
661        [feature = "1.10.1"] H5E_CANTMARKCLEAN => CantMarkClean,
662        H5E_CANTMARKDIRTY => CantMarkDirty,
663        [feature = "1.10.1"] H5E_CANTMARKSERIALIZED => CantMarkSerialized,
664        [feature = "1.10.1"] H5E_CANTMARKUNSERIALIZED => CantMarkUnserialized,
665        H5E_CANTMERGE => CantMerge,
666        H5E_CANTMODIFY => CantModify,
667        H5E_CANTMOVE => CantMove,
668        H5E_CANTNEXT => CantNext,
669        [feature = "1.10.0"] H5E_CANTNOTIFY => CantNotify,
670        H5E_CANTOPENFILE => CantOpenFile,
671        H5E_CANTOPENOBJ => CantOpenObj,
672        H5E_CANTOPERATE => CantOperate,
673        H5E_CANTPACK => CantPack,
674        H5E_CANTPIN => CantPin,
675        H5E_CANTPROTECT => CantProtect,
676        [feature = "1.14.0"] H5E_CANTPUT => CantPut,
677        H5E_CANTRECV => CantRecv,
678        H5E_CANTREDISTRIBUTE => CantRedistribute,
679        H5E_CANTREGISTER => CantRegister,
680        H5E_CANTRELEASE => CantRelease,
681        H5E_CANTREMOVE => CantRemove,
682        H5E_CANTRENAME => CantRename,
683        H5E_CANTRESET => CantReset,
684        H5E_CANTRESIZE => CantResize,
685        H5E_CANTRESTORE => CantRestore,
686        H5E_CANTREVIVE => CantRevive,
687        H5E_CANTSELECT => CantSelect,
688        H5E_CANTSERIALIZE => CantSerialize,
689        H5E_CANTSET => CantSet,
690        H5E_CANTSHRINK => CantShrink,
691        H5E_CANTSORT => CantSort,
692        H5E_CANTSPLIT => CantSplit,
693        H5E_CANTSWAP => CantSwap,
694        [feature = "1.10.0"] H5E_CANTTAG => CantTag,
695        [feature = "1.10.0"] H5E_CANTUNCORK => CantUncork,
696        [feature = "1.10.0"] H5E_CANTUNDEPEND => CantUndepend,
697        H5E_CANTUNLOCK => CantUnlock,
698        [any(all(feature = "1.10.7", not(feature = "1.12.0")), feature = "1.12.1")] H5E_CANTUNLOCKFILE => CantUnlockFile,
699        H5E_CANTUNPIN => CantUnpin,
700        H5E_CANTUNPROTECT => CantUnprotect,
701        [feature = "1.10.1"] H5E_CANTUNSERIALIZE => CantUnserialize,
702        H5E_CANTUPDATE => CantUpdate,
703        [feature = "1.14.0"] H5E_CANTWAIT => CantWait,
704        H5E_CLOSEERROR => CloseError,
705        H5E_COMPLEN => CompLen,
706        H5E_DUPCLASS => DupClass,
707        H5E_EXISTS => Exists,
708        H5E_FCNTL => Fcntl,
709        H5E_FILEEXISTS => FileExists,
710        H5E_FILEOPEN => FileOpen,
711        [feature = "1.10.7"] H5E_INCONSISTENTSTATE => InconsistentState,
712        H5E_LINKCOUNT => LinkCount,
713        [all(feature = "1.10.0", not(feature = "1.12.0"))] H5E_LOGFAIL => Logging,
714        [feature = "1.10.5"] H5E_LOGGING => Logging,
715        H5E_MOUNT => Mount,
716        H5E_MPI => Mpi,
717        H5E_MPIERRSTR => MpiErrStr,
718        H5E_NLINKS => NLinks,
719        H5E_NOENCODER => NoEncoder,
720        H5E_NOFILTER => NoFilter,
721        H5E_NOIDS => NoIds,
722        [feature = "1.10.2"] H5E_NO_INDEPENDENT => NoIndependent,
723        H5E_NOSPACE => NoSpace,
724        H5E_NONE_MINOR => NoneMinor,
725        H5E_NOTCACHED => NotCached,
726        H5E_NOTFOUND => NotFound,
727        H5E_NOTHDF5 => NotHdf5,
728        H5E_NOTREGISTERED => NotRegistered,
729        H5E_OBJOPEN => ObjOpen,
730        [feature = "1.8.11"] H5E_OPENERROR => OpenError,
731        H5E_OVERFLOW => Overflow,
732        H5E_PATH => Path,
733        H5E_PROTECT => Protect,
734        H5E_READERROR => ReadError,
735        H5E_SEEKERROR => SeekError,
736        [feature = "1.8.9"] H5E_SETDISALLOWED => SetDisallowed,
737        H5E_SETLOCAL => SetLocal,
738        H5E_SYSERRSTR => SysErrStr,
739        H5E_SYSTEM => System,
740        H5E_TRAVERSE => Traverse,
741        H5E_TRUNCATED => Truncated,
742        H5E_UNINITIALIZED => Uninitialized,
743        [feature = "1.14.0"] H5E_UNMOUNT => Unmount,
744        H5E_UNSUPPORTED => Unsupported,
745        H5E_VERSION => Version,
746        H5E_WRITEERROR => WriteError,
747    }
748
749    meta {
750        Alignment => ("H5E_ALIGNMENT", "Alignment error"),
751        AlreadyExists => ("H5E_ALREADYEXISTS", "Object already exists"),
752        AlreadyInit => ("H5E_ALREADYINIT", "Object already initialized"),
753        BadFile => ("H5E_BADFILE", "Bad file ID accessed"),
754        BadGroup => ("H5E_BADGROUP", "Unable to find ID group information"),
755        [feature = "1.14.0"] BadId => ("H5E_BADID", "Unable to find ID information (already closed?)"),
756        [not(feature = "1.14.0")] BadId => ("H5E_BADATOM", "Unable to find atom information (already closed?)"),
757        BadIter => ("H5E_BADITER", "Iteration failed"),
758        BadMessage => ("H5E_BADMESG", "Unrecognized message"),
759        BadRange => ("H5E_BADRANGE", "Out of range"),
760        BadSelect => ("H5E_BADSELECT", "Invalid selection"),
761        BadSize => ("H5E_BADSIZE", "Bad size for object"),
762        BadType => ("H5E_BADTYPE", "Inappropriate type"),
763        BadValue => ("H5E_BADVALUE", "Bad value"),
764        Callback => ("H5E_CALLBACK", "Callback failed"),
765        CanApply => ("H5E_CANAPPLY", "Error from filter 'can apply' callback"),
766        CantAlloc => ("H5E_CANTALLOC", "Can't allocate space"),
767        CantAppend => ("H5E_CANTAPPEND", "Can't append object"),
768        CantAttach => ("H5E_CANTATTACH", "Can't attach object"),
769        CantCancel => ("H5E_CANTCANCEL", "Can't cancel operation"),
770        CantClean => ("H5E_CANTCLEAN", "Unable to mark metadata as clean"),
771        CantClip => ("H5E_CANTCLIP", "Can't clip hyperslab region"),
772        CantCloseFile => ("H5E_CANTCLOSEFILE", "Unable to close file"),
773        CantCloseObj => ("H5E_CANTCLOSEOBJ", "Can't close object"),
774        CantCompare => ("H5E_CANTCOMPARE", "Can't compare objects"),
775        CantCompute => ("H5E_CANTCOMPUTE", "Can't compute value"),
776        CantConvert => ("H5E_CANTCONVERT", "Can't convert datatypes"),
777        CantCopy => ("H5E_CANTCOPY", "Unable to copy object"),
778        CantCork => ("H5E_CANTCORK", "Unable to cork an object"),
779        CantCount => ("H5E_CANTCOUNT", "Can't count elements"),
780        CantCreate => ("H5E_CANTCREATE", "Unable to create file"),
781        CantDec => ("H5E_CANTDEC", "Unable to decrement reference count"),
782        CantDecode => ("H5E_CANTDECODE", "Unable to decode value"),
783        CantDelete => ("H5E_CANTDELETE", "Can't delete message"),
784        CantDeleteFile => ("H5E_CANTDELETEFILE", "Unable to delete file"),
785        CantDepend => ("H5E_CANTDEPEND", "Unable to create a flush dependency"),
786        CantDirty => ("H5E_CANTDIRTY", "Unable to mark metadata as dirty"),
787        CantEncode => ("H5E_CANTENCODE", "Unable to encode value"),
788        CantExpunge => ("H5E_CANTEXPUNGE", "Unable to expunge a metadata cache entry"),
789        CantExtend => ("H5E_CANTEXTEND", "Can't extend heap's space"),
790        CantFilter => ("H5E_CANTFILTER", "Filter operation failed"),
791        CantFind => ("H5E_CANTFIND", "Unable to check for record"),
792        CantFlush => ("H5E_CANTFLUSH", "Unable to flush data from cache"),
793        CantFree => ("H5E_CANTFREE", "Unable to free object"),
794        CantGather => ("H5E_CANTGATHER", "Can't gather data"),
795        CantGc => ("H5E_CANTGC", "Unable to garbage collect"),
796        CantGet => ("H5E_CANTGET", "Can't get value"),
797        CantGetSize => ("H5E_CANTGETSIZE", "Unable to compute size"),
798        CantInc => ("H5E_CANTINC", "Unable to increment reference count"),
799        CantInit => ("H5E_CANTINIT", "Unable to initialize object"),
800        CantIns => ("H5E_CANTINS", "Unable to insert metadata into cache"),
801        CantInsert => ("H5E_CANTINSERT", "Unable to insert object"),
802        CantList => ("H5E_CANTLIST", "Unable to list node"),
803        CantLoad => ("H5E_CANTLOAD", "Unable to load metadata into cache"),
804        CantLock => ("H5E_CANTLOCK", "Unable to lock object"),
805        CantLockFile => ("H5E_CANTLOCKFILE", "Unable to lock file"),
806        CantMarkClean => ("H5E_CANTMARKCLEAN", "Unable to mark a pinned entry as clean"),
807        CantMarkDirty => ("H5E_CANTMARKDIRTY", "Unable to mark a pinned entry as dirty"),
808        CantMarkSerialized => ("H5E_CANTMARKSERIALIZED", "Unable to mark an entry as serialized"),
809        CantMarkUnserialized => ("H5E_CANTMARKUNSERIALIZED", "Unable to mark an entry as unserialized"),
810        CantMerge => ("H5E_CANTMERGE", "Can't merge objects"),
811        CantModify => ("H5E_CANTMODIFY", "Unable to modify record"),
812        CantMove => ("H5E_CANTMOVE", "Can't move object"),
813        CantNext => ("H5E_CANTNEXT", "Can't move to next iterator location"),
814        CantNotify => ("H5E_CANTNOTIFY", "Unable to notify object about action"),
815        CantOpenFile => ("H5E_CANTOPENFILE", "Unable to open file"),
816        CantOpenObj => ("H5E_CANTOPENOBJ", "Can't open object"),
817        CantOperate => ("H5E_CANTOPERATE", "Can't operate on object"),
818        CantPack => ("H5E_CANTPACK", "Can't pack messages"),
819        CantPin => ("H5E_CANTPIN", "Unable to pin cache entry"),
820        CantProtect => ("H5E_CANTPROTECT", "Unable to protect metadata"),
821        CantPut => ("H5E_CANTPUT", "Can't put value"),
822        CantRecv => ("H5E_CANTRECV", "Can't receive data"),
823        CantRedistribute => ("H5E_CANTREDISTRIBUTE", "Unable to redistribute records"),
824        CantRegister => ("H5E_CANTREGISTER", "Unable to register new ID"),
825        CantRelease => ("H5E_CANTRELEASE", "Unable to release object"),
826        CantRemove => ("H5E_CANTREMOVE", "Unable to remove object"),
827        CantRename => ("H5E_CANTRENAME", "Unable to rename object"),
828        CantReset => ("H5E_CANTRESET", "Can't reset object"),
829        CantResize => ("H5E_CANTRESIZE", "Unable to resize a metadata cache entry"),
830        CantRestore => ("H5E_CANTRESTORE", "Can't restore condition"),
831        CantRevive => ("H5E_CANTREVIVE", "Can't revive object"),
832        CantSelect => ("H5E_CANTSELECT", "Can't select hyperslab"),
833        CantSerialize => ("H5E_CANTSERIALIZE", "Unable to serialize data from cache"),
834        CantSet => ("H5E_CANTSET", "Can't set value"),
835        CantShrink => ("H5E_CANTSHRINK", "Can't shrink container"),
836        CantSort => ("H5E_CANTSORT", "Can't sort objects"),
837        CantSplit => ("H5E_CANTSPLIT", "Unable to split node"),
838        CantSwap => ("H5E_CANTSWAP", "Unable to swap records"),
839        CantTag => ("H5E_CANTTAG", "Unable to tag metadata in the cache"),
840        CantUncork => ("H5E_CANTUNCORK", "Unable to uncork an object"),
841        CantUndepend => ("H5E_CANTUNDEPEND", "Unable to destroy a flush dependency"),
842        CantUnlock => ("H5E_CANTUNLOCK", "Unable to unlock object"),
843        CantUnlockFile => ("H5E_CANTUNLOCKFILE", "Unable to unlock file"),
844        CantUnpin => ("H5E_CANTUNPIN", "Unable to un-pin cache entry"),
845        CantUnprotect => ("H5E_CANTUNPROTECT", "Unable to unprotect metadata"),
846        CantUnserialize => ("H5E_CANTUNSERIALIZE", "Unable to mark metadata as unserialized"),
847        CantUpdate => ("H5E_CANTUPDATE", "Can't update object"),
848        CantWait => ("H5E_CANTWAIT", "Can't wait on operation"),
849        CloseError => ("H5E_CLOSEERROR", "Close failed"),
850        CompLen => ("H5E_COMPLEN", "Name component is too long"),
851        DupClass => ("H5E_DUPCLASS", "Duplicate class name in parent class"),
852        Exists => ("H5E_EXISTS", "Object already exists"),
853        Fcntl => ("H5E_FCNTL", "File control (fcntl) failed"),
854        FileExists => ("H5E_FILEEXISTS", "File already exists"),
855        FileOpen => ("H5E_FILEOPEN", "File already open"),
856        InconsistentState => ("H5E_INCONSISTENTSTATE", "Internal states are inconsistent"),
857        LinkCount => ("H5E_LINKCOUNT", "Bad object header link count"),
858        [all(feature = "1.10.0", not(feature = "1.10.5"))] Logging => ("H5E_LOGFAIL", "Failure in the cache logging framework"),
859        [not(all(feature = "1.10.0", not(feature = "1.10.5")))] Logging => ("H5E_LOGGING", "Failure in the cache logging framework"),
860        Mount => ("H5E_MOUNT", "File mount error"),
861        Mpi => ("H5E_MPI", "Some MPI function failed"),
862        MpiErrStr => ("H5E_MPIERRSTR", "MPI Error String"),
863        NLinks => ("H5E_NLINKS", "Too many soft links in path"),
864        NoEncoder => ("H5E_NOENCODER", "Filter present but encoding disabled"),
865        NoFilter => ("H5E_NOFILTER", "Requested filter is not available"),
866        NoIds => ("H5E_NOIDS", "Out of IDs for group"),
867        NoIndependent => ("H5E_NO_INDEPENDENT", "Can't perform independent IO"),
868        NoSpace => ("H5E_NOSPACE", "No space available for allocation"),
869        NoneMinor => ("H5E_NONE_MINOR", "No error"),
870        NotCached => ("H5E_NOTCACHED", "Metadata not currently cached"),
871        NotFound => ("H5E_NOTFOUND", "Object not found"),
872        NotHdf5 => ("H5E_NOTHDF5", "Not an HDF5 file"),
873        NotRegistered => ("H5E_NOTREGISTERED", "Link class not registered"),
874        ObjOpen => ("H5E_OBJOPEN", "Object is already open"),
875        OpenError => ("H5E_OPENERROR", "Can't open directory or file"),
876        Overflow => ("H5E_OVERFLOW", "Address overflowed"),
877        Path => ("H5E_PATH", "Problem with path to object"),
878        Protect => ("H5E_PROTECT", "Protected metadata error"),
879        ReadError => ("H5E_READERROR", "Read failed"),
880        SeekError => ("H5E_SEEKERROR", "Seek failed"),
881        SetDisallowed => ("H5E_SETDISALLOWED", "Disallowed operation"),
882        SetLocal => ("H5E_SETLOCAL", "Error from filter 'set local' callback"),
883        SysErrStr => ("H5E_SYSERRSTR", "System error message"),
884        System => ("H5E_SYSTEM", "Internal error detected"),
885        Traverse => ("H5E_TRAVERSE", "Link traversal failure"),
886        Truncated => ("H5E_TRUNCATED", "File has been truncated"),
887        Uninitialized => ("H5E_UNINITIALIZED", "Information is uinitialized"),
888        Unmount => ("H5E_UNMOUNT", "File unmount error"),
889        Unsupported => ("H5E_UNSUPPORTED", "Feature is unsupported"),
890        Version => ("H5E_VERSION", "Wrong version number"),
891        WriteError => ("H5E_WRITEERROR", "Write failed"),
892    }
893}