Skip to content

Commit 8419a2f

Browse files
committed
add errmsg
1 parent 8d76854 commit 8419a2f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/value/basic/str_value.f90

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,23 @@ pure function str_value_to_str(value) result(str)
4949
str = """"""
5050
end function
5151

52-
subroutine parse_str(from, to, err)
52+
subroutine parse_str(from, to, err, errmsg)
5353
class(value_t), intent(in) :: from
5454
character(len=:), allocatable, intent(inout) :: to
55-
type(err_t), intent(inout), optional :: err
55+
type(err_t), intent(out), optional :: err
56+
character(len=*), intent(in), optional :: errmsg
5657

5758
select type(from)
5859
class is (str_value_t)
5960
to = from % value
6061
return
6162
end select
6263

63-
call seterr( err, "expected string but got: " // from % to_str() )
64+
if (present(errmsg)) then
65+
call seterr( err, errmsg )
66+
else
67+
call seterr( err, "expected string but got: " // from % to_str() )
68+
end if
6469
end subroutine
6570

6671
end module

0 commit comments

Comments
 (0)