@@ -70,7 +70,10 @@ template noWeirdTarget*(def) =
70
70
71
71
proc raiseExcWithPath* (p: PathLike, errCode: OSErrorCode){.sideEffect.} =
72
72
# # raises OSError or its one of SubError type
73
- raise OSError_new[oserrors_types.PyOSError](true, errCode.cint , p.fspath)
73
+ raise when defined(windows):
74
+ OSError_new[oserrors_types.PyOSError](0, p.fspath, winerror=errCode.cint )
75
+ else:
76
+ OSError_new[oserrors_types.PyOSError](errCode.cint , p.fspath)
74
77
75
78
proc raiseExcWithPath*(p: PathLike){.sideEffect.} =
76
79
let oserr = osLastError()
@@ -119,7 +122,7 @@ elif not weirdTarget:
119
122
func errnoMsg*(errno: cint ): string = $c_strerror(errno)
120
123
121
124
proc newErrnoErrT[E: PyOSError](errno=getErrno(), strerr: string ): owned (ref PyOSError) =
122
- OSError_new[E](false, errno, strerr)
125
+ OSError_new[E](errno, strerr)
123
126
proc newErrnoErrT[E: PyOSError](errno=getErrno()): owned (ref PyOSError) =
124
127
newErrnoErrT[E](errno, errnoMsg(errno))
125
128
@@ -136,11 +139,11 @@ proc raiseErrnoT*[T: PyOSError](errno=getErrno()) =
136
139
proc raiseErrnoWithPath*[T](p: PathLike[T]; errno = getErrno()) =
137
140
## raises OSError or its SubError.
138
141
## refer to errno even under Windows.
139
- raise OSError_new[oserrors_types.PyOSError](false, errno, errnoMsg(errno), p.fspath)
142
+ raise OSError_new[oserrors_types.PyOSError](errno, errnoMsg(errno), p.fspath)
140
143
141
144
when InJs:
142
145
proc raiseErrnoWithMsg*(errno: cint , errMsg: string ) =
143
- raise OSError_new[oserrors_types.PyOSError](false, errno, errMsg, fillMsg=false)
146
+ raise OSError_new[oserrors_types.PyOSError](errno, errMsg, fillMsg=false)
144
147
145
148
template catchJsErrAndDo(doSth; doErr) =
146
149
var errMsg = ""
0 commit comments