From: Doug Coleman Date: Fri, 3 Jan 2020 19:04:01 +0000 (-0600) Subject: Revert "Delete throw-win32-error, replace with win32-error calls" X-Git-Tag: 0.99~3607 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=d9f1093cf8f9a34d8ad85024836c57c62a81ecc8 Revert "Delete throw-win32-error, replace with win32-error calls" This reverts commit e1be081ec93061d1e236d6d6f4c1778feef854c2. --- diff --git a/basis/io/directories/windows/windows.factor b/basis/io/directories/windows/windows.factor index 083c5187fb..76cc8f33f0 100644 --- a/basis/io/directories/windows/windows.factor +++ b/basis/io/directories/windows/windows.factor @@ -31,7 +31,7 @@ ERROR: file-delete-failed path error ; : (delete-file) ( path -- ) dup DeleteFile 0 = [ GetLastError ERROR_ACCESS_DENIED = - [ delete-read-only-file ] [ win32-error ] if + [ delete-read-only-file ] [ throw-win32-error ] if ] [ drop ] if ; M: windows delete-file ( path -- ) diff --git a/basis/io/files/windows/windows.factor b/basis/io/files/windows/windows.factor index 518fa8daab..0531551b60 100644 --- a/basis/io/files/windows/windows.factor +++ b/basis/io/files/windows/windows.factor @@ -117,7 +117,7 @@ M: windows init-io ( -- ) : handle>file-size ( handle -- n/f ) (handle>file-size) [ GetLastError ERROR_INVALID_FUNCTION = - [ f ] [ win32-error ] if + [ f ] [ throw-win32-error ] if ] unless* ; ERROR: seek-before-start n ; @@ -400,7 +400,7 @@ M: windows home 0 [ FindFirstStream ] keepd over INVALID_HANDLE_VALUE = [ - 2drop win32-error + 2drop throw-win32-error ] [ 1vector swap file-streams-rest ] if ; diff --git a/basis/windows/errors/errors.factor b/basis/windows/errors/errors.factor index 5679a62eba..82e8701d16 100644 --- a/basis/windows/errors/errors.factor +++ b/basis/windows/errors/errors.factor @@ -740,6 +740,9 @@ ERROR: windows-error n string ; dup n>win32-error-string windows-error ] if ; +: throw-win32-error ( -- * ) + win32-error-string throw ; + : check-invalid-handle ( handle -- handle ) dup INVALID_HANDLE_VALUE = [ win32-error ] when ; @@ -755,7 +758,11 @@ CONSTANT: expected-io-errors expected-io-errors member? ; : expected-io-error ( error-code -- ) - expected-io-error? [ win32-error ] unless ; + dup expected-io-error? [ + drop + ] [ + throw-win32-error + ] if ; : io-error ( return-value -- ) { 0 f } member? [ GetLastError expected-io-error ] when ;