Skip to content

Commit 8867398

Browse files
committed
some improvements to error messages for invalid inputs for initialize().
1 parent c169652 commit 8867398

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/json_value_module.F90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,8 @@ subroutine json_initialize(me,&
10031003
integer(IK) :: istat !! `iostat` flag for
10041004
!! write statements
10051005
logical(LK) :: sgn_prnt !! print sign flag
1006+
character(kind=CK,len=max_integer_str_len) :: istr !! for integer to
1007+
!! string conversion
10061008

10071009
!reset exception to false:
10081010
call me%clear_exceptions()
@@ -1085,7 +1087,8 @@ subroutine json_initialize(me,&
10851087
me%null_to_real_mode = null_to_real_mode
10861088
case default
10871089
me%null_to_real_mode = 2_IK ! just to have a valid value
1088-
call me%throw_exception('Invalid null_to_real_mode.')
1090+
call integer_to_string(null_to_real_mode,int_fmt,istr)
1091+
call me%throw_exception('Invalid null_to_real_mode: '//istr)
10891092
end select
10901093
end if
10911094

@@ -1097,7 +1100,8 @@ subroutine json_initialize(me,&
10971100
case(2_IK) ! use null
10981101
me%non_normals_to_null = .true.
10991102
case default
1100-
call me%throw_exception('Invalid non_normal_mode.')
1103+
call integer_to_string(non_normal_mode,int_fmt,istr)
1104+
call me%throw_exception('Invalid non_normal_mode: '//istr)
11011105
end select
11021106
end if
11031107

0 commit comments

Comments
 (0)