Skip to content

Commit 41779fd

Browse files
committed
Improve error handling
1 parent 7524eb7 commit 41779fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

openmp/helper_functions.F90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ subroutine write_array(filename, array, ierr)
9898

9999
open(newunit=unit, file=filename, form='unformatted', access='stream', status='replace', action='write', iostat=ios)
100100
if (ios /= 0) then
101-
print *, "Failed to open file"
101+
write(0,*) "Failed to open file"
102102
local_err = 1
103103
if (present(ierr)) ierr = local_err
104104
level = c_roctxRangePop()
105105
return
106106
end if
107107

108108
write(unit) size(array, kind=8)
109-
write(unit) array
109+
write(unit, iostat=ios) array
110110
close(unit)
111111

112112
if (ios /= 0) then
113-
print *, "Failed to write all elements to file"
113+
write(0,*) "Failed to write all elements to file"
114114
local_err = 2
115115
else
116116
local_err = 0

0 commit comments

Comments
 (0)