src/pylib/pyerrors/oserr

Source   Edit  

See CPython's Objects/exceptions.c

OSError_new(a.k.a. OSError.__new__) will returns a subclass of OSError, via lookup in state->errnomap, which is initialized by _PyExc_InitState,

where key-value pairs are inserted via ADD_ERRNO macro.

Procs

func errnoMsg(errno: cint): string {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc raiseErrno(errno = getErrno()) {....raises: [PyOSError], tags: [], forbids: [].}
may raise subclass of OSError Source   Edit  
proc raiseErrnoT[T: PyOSError](errno = getErrno())
Source   Edit  
proc raiseErrnoWithPath[T](p: PathLike[T]; errno = getErrno())
raises OSError or its SubError. refer to errno even under Windows. Source   Edit  
func raiseExcWithPath(fp: PathLike; exc: typedesc; err: OSErrorCode;
                      additionalInfo: string)
Source   Edit  
proc raiseExcWithPath(fp: PathLike; exc: typedesc; err: OSErrorCode;
                      osErrorMsgCb: proc = osErrorMsg)
Source   Edit  
proc raiseExcWithPath(p: PathLike) {.sideEffect.}
Source   Edit  
proc raiseExcWithPath(p: PathLike; errCode: OSErrorCode) {.sideEffect.}
raises OSError or its one of SubError type Source   Edit  
proc raiseExcWithPath2(src, dst: PathLike)
Source   Edit  

Templates

template noWeirdTarget(def)
Source   Edit  
template osErrorMsgWithPath(fp: PathLike; err: OSErrorCode): string
Source   Edit  
template osErrorMsgWithPath(fp: PathLike; err: OSErrorCode; osErrorMsgCb): string
always suffixed with a \n Source   Edit  
template tryOsOp(p1, p2: PathLike; body)
Source   Edit  
template tryOsOp(p: PathLike; body)
Source   Edit  
template tryOsOp(p: PathLike; raiseCond: bool; body)
Source   Edit  
template tryOsOp(raiseCond: bool; body)
Source   Edit