Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetErrorString and GetErrorStringLineCount/GetErrorStringLine are inconsistent when loading database #5

Open
scharlton2 opened this issue Jan 12, 2023 · 0 comments

Comments

@scharlton2
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant