Skip to content

Make endrun calls consistently use file and line options, remove subname, and "ERROR::" prepending it #1452

@ekluzek

Description

@ekluzek

@billsacks did some work on this in #1447. In there I suggested a few other changes that would be good to do.

Make sure errMsg is always used which gives the line number of the file, so allows you to easily find the problem. As such we should remove the use of "subname" which needs to be maintained if the subroutine name changes whereas the errMsg automatically updates the line number. We can also remove prepending the error message to endrun with a "ERROR::" as it's already in the shr_sys_abort call in endrun.

Also note that for unit testing to work, and to check error messaging, you have to have fixed text. So the endrun call should have a fixed message, and a separate line should give the line number and file info.

Alternatively we could add file and line to endrun as optional arguments. Later (see below) we decided to go with this so what the code should be changed to look like should be:

             call endrun(msg='Cannot find any input points matching output point', file=sourcefile, line=__LINE__)

Definition of done:

  • Agree on the right way to do this
  • Implement a change to endrun arguments if we decide to go that way Endrun work #3418
  • Start using this pattern for new code coming in
  • Apply this change everywhere
  • Also do this for code that uses shr_sys_abort or shr_abort_abort

Metadata

Metadata

Assignees

No one assigned

    Labels

    code healthimproving internal code structure to make easier to maintain (sustainability)priority: lowBackground task that doesn't need to be done right away.
    No fields configured for Code Health.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions