@@ -15,9 +15,9 @@ module Crystal::System::FileDescriptor
1515      bytes_read =  LibC ._read(fd, slice, slice.size)
1616      if  bytes_read ==  -1 
1717        if  Errno .value ==  Errno ::EBADF 
18-           raise  IO ::Error .new " File not open for reading" 
18+           raise  IO ::Error .new " File not open for reading" ,  target:   self 
1919        else 
20-           raise  IO ::Error .from_errno(" Error reading file" 
20+           raise  IO ::Error .from_errno(" Error reading file" ,  target:   self )
2121        end 
2222      end 
2323      bytes_read
@@ -36,9 +36,9 @@ module Crystal::System::FileDescriptor
3636        bytes_written =  LibC ._write(fd, slice, slice.size)
3737        if  bytes_written ==  -1 
3838          if  Errno .value ==  Errno ::EBADF 
39-             raise  IO ::Error .new " File not open for writing" 
39+             raise  IO ::Error .new " File not open for writing" ,  target:   self 
4040          else 
41-             raise  IO ::Error .from_errno(" Error writing file" 
41+             raise  IO ::Error .from_errno(" Error writing file" ,  target:   self )
4242          end 
4343        end 
4444      else 
@@ -106,7 +106,7 @@ module Crystal::System::FileDescriptor
106106
107107      if  file_type ==  LibC ::FILE_TYPE_UNKNOWN 
108108        error =  WinError .value
109-         raise  IO ::Error .from_os_error(" Unable to get info" unless  error ==  WinError ::ERROR_SUCCESS 
109+         raise  IO ::Error .from_os_error(" Unable to get info" ,  target:   self ) unless  error ==  WinError ::ERROR_SUCCESS 
110110      end 
111111    end 
112112
@@ -129,13 +129,13 @@ module Crystal::System::FileDescriptor
129129    seek_value =  LibC ._lseeki64(fd, offset, whence)
130130
131131    if  seek_value ==  -1 
132-       raise  IO ::Error .from_errno " Unable to seek" 
132+       raise  IO ::Error .from_errno " Unable to seek" ,  target:   self 
133133    end 
134134  end 
135135
136136  private  def  system_pos 
137137    pos =  LibC ._lseeki64(fd, 0 , IO ::Seek ::Current )
138-     raise  IO ::Error .from_errno  " Unable to tell" if  pos ==  -1 
138+     raise  IO ::Error .from_errno( " Unable to tell" ,  target:   self )  if  pos ==  -1 
139139    pos
140140  end 
141141
@@ -165,7 +165,7 @@ module Crystal::System::FileDescriptor
165165      when  Errno ::EINTR 
166166        #  ignore
167167      else 
168-         raise  IO ::Error .from_errno(" Error closing file" 
168+         raise  IO ::Error .from_errno(" Error closing file" ,  target:   self )
169169      end 
170170    end 
171171  end 
@@ -204,7 +204,7 @@ module Crystal::System::FileDescriptor
204204    if  LibC .ReadFile (handle, buffer, buffer.size, out  bytes_read, pointerof (overlapped)) ==  0 
205205      error =  WinError .value
206206      return  0 _i64  if  error ==  WinError ::ERROR_HANDLE_EOF 
207-       raise  IO ::Error .from_os_error " Error reading file" 
207+       raise  IO ::Error .from_os_error " Error reading file" ,  target:   self 
208208    end 
209209
210210    bytes_read.to_i64
0 commit comments