When calling LoadDatabase or LoadDatabaseString with a missing database, GetErrorString and OutputErrorString behave as expected but GetErrorStringLineCount and GetErrorStringLine do not.
ie
id = CreateIphreeqc()
if (id .LT. 0) stop
res = SetErrorOn(id, .TRUE.)
res = LoadDatabase(id, 'phreeqcxx.dat')
if (res .NE. 0) then
call OutputErrorString(id)
endif
write (*,'("Returned LoadDatabase with ",I0," errors."/)') res
Outputs:
ERROR: LoadDatabase: Unable to open:"phreeqcxx.dat".
Returned LoadDatabase with 1 errors.
and
id = CreateIphreeqc()
if (id .LT. 0) stop
res = SetErrorStringOn (id, .TRUE.)
res = LoadDatabase(id, 'phreeqcxx.dat')
if (res .NE. 0) then
do i = 1, GetErrorStringLineCount(id)
CALL GetErrorStringLine(id,i,Line)
write (*,'(A)') trim(line)
enddo
endif
write (*,'("Returned LoadDatabase with ",I0," errors."/)') res
Outputs:
Returned LoadDatabase with 1 errors.
Proposed fix
Call IPhreeqc::update_errors at the end of LoadDatabase and LoadDatabaseString
When calling
LoadDatabase
orLoadDatabaseString
with a missing database,GetErrorString
andOutputErrorString
behave as expected butGetErrorStringLineCount
andGetErrorStringLine
do not.ie
Outputs:
and
Outputs:
Proposed fix
Call
IPhreeqc::update_errors
at the end ofLoadDatabase
andLoadDatabaseString