Skip to content

Commit 52fab8d

Browse files
committed
If using the 'found' argument in json_get_by_path, exceptions raised in this routine will now be cleared. Fixes #330
1 parent a0610b8 commit 52fab8d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/json_value_module.F90

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5680,9 +5680,6 @@ end function wrap_json_valid_path
56805680
!
56815681
! * The original JSON-Fortran defaults
56825682
! * [RFC 6901](https://tools.ietf.org/html/rfc6901)
5683-
!
5684-
!@warning if `found` is present, we should clear any exceptions that are thrown
5685-
! to be consistent with other routines. This is not currently being done.
56865683

56875684
subroutine json_get_by_path(json, me, path, p, found)
56885685

@@ -5717,6 +5714,10 @@ subroutine json_get_by_path(json, me, path, p, found)
57175714
if (present(found)) found = .false.
57185715
end select
57195716

5717+
if (present(found)) then
5718+
if (.not. found) call json%clear_exceptions()
5719+
end if
5720+
57205721
else
57215722
if (present(found)) found = .false.
57225723
end if

0 commit comments

Comments
 (0)