Skip to content

Commit

Permalink
EXODUS: Clean up some error output/handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Sep 4, 2024
1 parent 46488d7 commit 88b005a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/seacas/libraries/exodus/include/exodusII.h
Original file line number Diff line number Diff line change
Expand Up @@ -1955,9 +1955,9 @@ enum ex_error_return_code {
EX_LASTERR = -1003, /**< in ex_err, use existing err_num value */
EX_NULLENTITY = -1006, /**< null entity found */
EX_NOENTITY = -1007, /**< no entities of that type on database */
EX_NOTFOUND = -1008, /**< could not find requested variable on database */
EX_INTSIZEMISMATCH =
-1008, /**< integer sizes do not match on input/output databases in ex_copy */
EX_NOTFOUND = -1008, /**< could not find requested variable on database */
-1009, /**< integer sizes do not match on input/output databases in ex_copy */

EX_FATAL = -1, /**< fatal error flag def */
EX_NOERR = 0, /**< no error flag def */
Expand Down
3 changes: 2 additions & 1 deletion packages/seacas/libraries/exodus/src/ex_err.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions
* Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
* NTESS, the U.S. Government retains certain rights in this software.
*
Expand Down Expand Up @@ -345,6 +345,7 @@ const char *ex_strerror(int err_num)
case EX_INTERNAL: return "Internal logic error in exodus library.";
case EX_NOTROOTID: return "File id is not the root id; it is a subgroup id.";
case EX_NULLENTITY: return "Null entity found.";
case EX_NOTFOUND: return "Could not find requested variable on database.";
case EX_INTSIZEMISMATCH: return "Integer sizes must match for input and output file in ex_copy.";
case EX_MSG: return "Message printed; no error implied.";
default: return nc_strerror(err_num);
Expand Down
7 changes: 4 additions & 3 deletions packages/seacas/libraries/exodus/src/ex_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ int exi_check_file_type(const char *path, int *type)
FILE *fp;
if (!(fp = fopen(path, "r"))) {
char errmsg[MAX_ERR_LENGTH];
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Could not open file '%s', error = %s.", path,
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Could not open file '%s',\n\t\terror = %s.", path,
strerror(errno));
ex_err(__func__, errmsg, EX_WRONGFILETYPE);
EX_FUNC_LEAVE(EX_FATAL);
Expand All @@ -203,8 +203,9 @@ int exi_check_file_type(const char *path, int *type)
fclose(fp);
if (i != MAGIC_NUMBER_LEN) {
char errmsg[MAX_ERR_LENGTH];
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Could not read magic data from file '%s', err = %s.",
path, strerror(errno));
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: Could not read magic data from file '%s',\n\t\terror = %s.", path,
strerror(errno));
ex_err(__func__, errmsg, EX_WRONGFILETYPE);
EX_FUNC_LEAVE(EX_FATAL);
}
Expand Down

0 comments on commit 88b005a

Please sign in to comment.