src/pylib/pyerrors/oserr

Source   Edit  

Types

FileExistsError = object of OSError
Source   Edit  
FileNotFoundError = object of OSError
Source   Edit  
IsADirectoryError = object of OSError
Source   Edit  
NotADirectoryError = object of OSError
Source   Edit  

Procs

func errnoMsg(errnoCode: cint): string {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc isNotFound(err: OSErrorCode): bool {....raises: [], tags: [], forbids: [].}
Source   Edit  
func pathsAsOne[T](a, b: PathLike[T]; sep = " -> "): string
used when there are two pathes that needs to be reported in error message. called by raiseExcWithPath2 Source   Edit  
proc raiseErrno(additionalInfo = "") {....raises: [OSError], tags: [], forbids: [].}
may raise OSError only Source   Edit  
proc raiseErrnoWithPath[T](p: PathLike[T])
raises OSError or its SubError. refer to errno even under Windows. Source   Edit  
func raiseExcWithPath(fp: PathLike; exc: typedesc; err: OSErrorCode)
Source   Edit  
func raiseExcWithPath(fp: PathLike; exc: typedesc; err: OSErrorCode;
                      additionalInfo: string)
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  
func raiseFileNotFoundError(fp: PathLike)
with static msg: "No such file or directory" Source   Edit  
func raiseFileNotFoundError(fp: PathLike; err: OSErrorCode)
under Windows, both ERROR_FILE_NOT_FOUND and ERROR_PATH_NOT_FOUND lead to FileNotFoundError, at pass err to distinguish them 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(p: PathLike; body)
Source   Edit