ESCOMP / ESCOMP/CTSM

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

Open
#1,452 2 comments 0 reactions 0 assignees View on GitHub
code health priority: low
Dominant language
Fortran
Stars
352
Forks
361
Avg merge
6d 6h
Merged PRs (30d)
8

Description

@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:

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

Definition of done:
- [x] Agree on the right way to do this
- [x] Implement a change to endrun arguments if we decide to go that way #3418
- [x] 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.