Skip to content

Commit

Permalink
Added error type.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Oct 12, 2024
1 parent 370a1dd commit 736e5bd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
49 changes: 26 additions & 23 deletions src/dm_error.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,30 @@ module dm_error
integer, parameter, public :: E_DUMMY = 2 !! Dummy error or not implemented.
integer, parameter, public :: E_INVALID = 3 !! Invalid input/argument.
integer, parameter, public :: E_INCOMPLETE = 4 !! Input/argument missing.
integer, parameter, public :: E_TYPE = 5 !! Type error.
integer, parameter, public :: E_IO = 6 !! I/O operation failed.
integer, parameter, public :: E_READ = 7 !! Read operation failed.
integer, parameter, public :: E_WRITE = 8 !! Write operation failed.
integer, parameter, public :: E_EOF = 9 !! I/O end of file.
integer, parameter, public :: E_EOR = 10 !! I/O end of record.
integer, parameter, public :: E_ALLOC = 11 !! Memory allocation failed.
integer, parameter, public :: E_BOUNDS = 12 !! Out of bounds error.
integer, parameter, public :: E_EXIST = 13 !! Resource exists.
integer, parameter, public :: E_SYSTEM = 14 !! System call failed.
integer, parameter, public :: E_MEMORY = 15 !! No memory.
integer, parameter, public :: E_FULL = 16 !! Disk full.
integer, parameter, public :: E_EMPTY = 17 !! No data.
integer, parameter, public :: E_NULL = 18 !! Pointer not associated.
integer, parameter, public :: E_LIMIT = 19 !! Memory limit reached.
integer, parameter, public :: E_TIMEOUT = 20 !! Timeout occured.
integer, parameter, public :: E_FORMAT = 21 !! Format error.
integer, parameter, public :: E_NOT_FOUND = 22 !! Resource not found.
integer, parameter, public :: E_PERM = 23 !! No permission.
integer, parameter, public :: E_READ_ONLY = 24 !! Read-only access.
integer, parameter, public :: E_CORRUPT = 25 !! Data corrupted.
integer, parameter, public :: E_CONFIG = 26 !! Invalid configuration error.
integer, parameter, public :: E_GEOCOM = 27 !! GeoCOM error.
integer, parameter, public :: E_UNEXPECTED = 5 !! Unexpected input.
integer, parameter, public :: E_TYPE = 6 !! Type error.
integer, parameter, public :: E_IO = 7 !! I/O operation failed.
integer, parameter, public :: E_READ = 8 !! Read operation failed.
integer, parameter, public :: E_WRITE = 9 !! Write operation failed.
integer, parameter, public :: E_EOF = 10 !! I/O end of file.
integer, parameter, public :: E_EOR = 11 !! I/O end of record.
integer, parameter, public :: E_ALLOC = 12 !! Memory allocation failed.
integer, parameter, public :: E_BOUNDS = 13 !! Out of bounds error.
integer, parameter, public :: E_EXIST = 14 !! Resource exists.
integer, parameter, public :: E_SYSTEM = 15 !! System call failed.
integer, parameter, public :: E_MEMORY = 16 !! No memory.
integer, parameter, public :: E_FULL = 17 !! Disk full.
integer, parameter, public :: E_EMPTY = 18 !! No data.
integer, parameter, public :: E_NULL = 19 !! Pointer not associated.
integer, parameter, public :: E_LIMIT = 20 !! Memory limit reached.
integer, parameter, public :: E_TIMEOUT = 21 !! Timeout occured.
integer, parameter, public :: E_FORMAT = 22 !! Format error.
integer, parameter, public :: E_NOT_FOUND = 23 !! Resource not found.
integer, parameter, public :: E_PERM = 24 !! No permission.
integer, parameter, public :: E_READ_ONLY = 25 !! Read-only access.
integer, parameter, public :: E_CORRUPT = 26 !! Data corrupted.
integer, parameter, public :: E_CONFIG = 27 !! Invalid configuration error.
integer, parameter, public :: E_GEOCOM = 28 !! GeoCOM error.

! Database errors.
integer, parameter, public :: E_DB = 30 !! Generic database error.
Expand Down Expand Up @@ -163,6 +164,8 @@ pure function dm_error_message(error) result(message)
message = 'invalid'
case (E_INCOMPLETE)
message = 'incomplete'
case (E_UNEXPECTED)
message = 'unexpected'
case (E_TYPE)
message = 'type error'
case (E_IO)
Expand Down
1 change: 1 addition & 0 deletions src/dm_lua_api.f90
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ integer function dm_lua_api_register(lua, errors, log_levels, procedures, respon
rc = dm_lua_set(lua, 'E_DUMMY', E_DUMMY); if (dm_is_error(rc)) return
rc = dm_lua_set(lua, 'E_INVALID', E_INVALID); if (dm_is_error(rc)) return
rc = dm_lua_set(lua, 'E_INCOMPLETE', E_INCOMPLETE); if (dm_is_error(rc)) return
rc = dm_lua_set(lua, 'E_UNEXPECTED', E_UNEXPECTED); if (dm_is_error(rc)) return
rc = dm_lua_set(lua, 'E_TYPE', E_TYPE); if (dm_is_error(rc)) return
rc = dm_lua_set(lua, 'E_IO', E_IO); if (dm_is_error(rc)) return
rc = dm_lua_set(lua, 'E_READ', E_READ); if (dm_is_error(rc)) return
Expand Down

0 comments on commit 736e5bd

Please sign in to comment.