GEOS-ESM / MAPL

MAPL is a foundation layer of the GEOS architecture, whose original purpose is to supplement the Earth System Modeling Framework (ESMF)
https://geos-esm.github.io/MAPL/
Apache License 2.0
26 stars 17 forks source link

Replace inconsistent handling of RC codes in MAPL #1958

Open darianboggs opened 1 year ago

darianboggs commented 1 year ago

ESMF and MAPL use the optional rc argument to indicate success and failure in many procedures. MAPL provides an exception/error handling system through preprocessor macros (include files) and procedures which serves as a standard exception/error handling mechanism. In some cases, MAPL and science procedures use the system in a manner inconsistent with the intended use. In turn, this can create bugs when procedures are changed. Where reasonably possible, the inconsistent procedures should be identified and remedied, with a focus on MAPL procedures.

darianboggs commented 1 year ago

This came up again with PR #2326. For now, MAPL_GetResource maintains the existing behavior, but it adds an optional, intent(out) argument to MAPL_GetResource so that existing code that handles the non-zero rc code can instead use the new argument to differentiate between a failure to set the value and a true error condition. Once the existing code is changed, MAPL_GetResource should be changed to no longer treat failure to find as an error condition.