mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
added error and warning code handling in Python API for new codes. Refs #7
This commit is contained in:
parent
f155dfad29
commit
064e1aef59
1 changed files with 13 additions and 0 deletions
|
|
@ -86,6 +86,19 @@ def _error_handler(err, func, args):
|
|||
elif err == _error_code('e_tally_invalid_id'):
|
||||
raise KeyError("No tally exists with ID={}.".format(args[0]))
|
||||
|
||||
elif err == _error_code('e_invalid_size'):
|
||||
raise MemoryError("Array size mismatch with memory allocated.")
|
||||
|
||||
elif err == _error_code('e_cell_no_material'):
|
||||
raise GeometryError("Operation on cell requires that it be filled"
|
||||
" with a material.")
|
||||
|
||||
elif err == _error_code('w_below_min_bound'):
|
||||
warn("Data has not been loaded beyond lower bound of {}.".format(args[0]))
|
||||
|
||||
elif err == _error_code('w_above_max_bound'):
|
||||
warn("Data has not been loaded beyond upper bound of {}.".format(args[0]))
|
||||
|
||||
elif err < 0:
|
||||
raise Exception("Unknown error encountered (code {}).".format(err))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue