diff options
-rw-r--r-- | lib/deprecated/pure/asyncio.nim | 6 | ||||
-rw-r--r-- | lib/deprecated/pure/sockets.nim | 32 | ||||
-rw-r--r-- | lib/packages/fsmonitor.nim | 2 | ||||
-rw-r--r-- | lib/pure/asyncnet.nim | 2 | ||||
-rw-r--r-- | lib/pure/colors.nim | 2 | ||||
-rw-r--r-- | lib/pure/encodings.nim | 2 | ||||
-rw-r--r-- | lib/pure/marshal.nim | 4 | ||||
-rw-r--r-- | lib/pure/memfiles.nim | 6 | ||||
-rw-r--r-- | lib/pure/nativesockets.nim | 4 | ||||
-rw-r--r-- | lib/pure/net.nim | 28 | ||||
-rw-r--r-- | lib/pure/osproc.nim | 2 | ||||
-rw-r--r-- | lib/pure/parseutils.nim | 2 | ||||
-rw-r--r-- | lib/pure/pegs.nim | 2 | ||||
-rw-r--r-- | lib/pure/streams.nim | 56 | ||||
-rw-r--r-- | lib/system.nim | 10 |
15 files changed, 80 insertions, 80 deletions
diff --git a/lib/deprecated/pure/asyncio.nim b/lib/deprecated/pure/asyncio.nim index 161941e53..39d77230a 100644 --- a/lib/deprecated/pure/asyncio.nim +++ b/lib/deprecated/pure/asyncio.nim @@ -180,7 +180,7 @@ proc asyncSocket*(domain: Domain = AF_INET, typ: SockType = SOCK_STREAM, protocol: Protocol = IPPROTO_TCP, buffered = true): AsyncSocket = ## Initialises an AsyncSocket object. If a socket cannot be initialised - ## EOS is raised. + ## OSError is raised. result = newAsyncSocket() result.socket = socket(domain, typ, protocol, buffered) result.proto = protocol @@ -476,7 +476,7 @@ proc recvLine*(s: AsyncSocket, line: var TaintedString): bool {.deprecated.} = ## if this function can only retrieve some data; it will save this data and ## add it to the result when a full line is retrieved. ## - ## Unlike ``sockets.recvLine`` this function will raise an EOS or ESSL + ## Unlike ``sockets.recvLine`` this function will raise an OSError or SslError ## exception if an error occurs. ## ## **Deprecated since version 0.9.2**: This function has been deprecated in @@ -512,7 +512,7 @@ proc readLine*(s: AsyncSocket, line: var TaintedString): bool = ## retrieved or the socket has been disconnected in which case ``line`` will ## be set to "". ## - ## This function will raise an EOS exception when a socket error occurs. + ## This function will raise an OSError exception when a socket error occurs. setLen(line.string, 0) var dataReceived = "".TaintedString var ret = s.socket.readLineAsync(dataReceived) diff --git a/lib/deprecated/pure/sockets.nim b/lib/deprecated/pure/sockets.nim index ed15f67e2..34881607f 100644 --- a/lib/deprecated/pure/sockets.nim +++ b/lib/deprecated/pure/sockets.nim @@ -23,7 +23,7 @@ ## ## SSL is supported through the OpenSSL library. This support can be activated ## by compiling with the ``-d:ssl`` switch. When an SSL socket is used it will -## raise ESSL exceptions when SSL errors occur. +## raise SslError exceptions when SSL errors occur. ## ## Asynchronous sockets are supported, however a better alternative is to use ## the `asyncio <asyncio.html>`_ module. @@ -262,7 +262,7 @@ proc socket*(domain: Domain = AF_INET, typ: SockType = SOCK_STREAM, protocol: Protocol = IPPROTO_TCP, buffered = true): Socket = ## Creates a new socket; returns `InvalidSocket` if an error occurs. - # TODO: Perhaps this should just raise EOS when an error occurs. + # TODO: Perhaps this should just raise OSError when an error occurs. when defined(Windows): result = newTSocket(winlean.socket(cint(domain), cint(typ), cint(protocol)), buffered) else: @@ -422,7 +422,7 @@ proc parseIp4*(s: string): BiggestInt = ## ## This is equivalent to `inet_ntoa`:idx:. ## - ## Raises EInvalidValue in case of an error. + ## Raises ValueError in case of an error. var a, b, c, d: int var i = 0 var j = parseInt(s, a, i) @@ -543,7 +543,7 @@ proc acceptAddr*(server: Socket, client: var Socket, address: var string) {. ## If ``server`` is non-blocking then this function returns immediately, and ## if there are no connections queued the returned socket will be ## ``InvalidSocket``. - ## This function will raise EOS if an error occurs. + ## This function will raise OSError if an error occurs. ## ## The resulting client will inherit any properties of the server socket. For ## example: whether the socket is buffered or not. @@ -664,7 +664,7 @@ proc close*(socket: Socket) = discard winlean.closesocket(socket.fd) else: discard posix.close(socket.fd) - # TODO: These values should not be discarded. An EOS should be raised. + # TODO: These values should not be discarded. An OSError should be raised. # http://stackoverflow.com/questions/12463473/what-happens-if-you-call-close-on-a-bsd-socket-multiple-times when defined(ssl): if socket.isSSL: @@ -920,7 +920,7 @@ when defined(ssl): ## Returns ``False`` whenever the socket is not yet ready for a handshake, ## ``True`` whenever handshake completed successfully. ## - ## A ESSL error is raised on any other errors. + ## A SslError error is raised on any other errors. result = true if socket.isSSL: var ret = SSLConnect(socket.sslHandle) @@ -946,7 +946,7 @@ when defined(ssl): ## Determines whether a handshake has occurred between a client (``socket``) ## and the server that ``socket`` is connected to. ## - ## Throws ESSL if ``socket`` is not an SSL socket. + ## Throws SslError if ``socket`` is not an SSL socket. if socket.isSSL: return not socket.sslNoHandshake else: @@ -1215,7 +1215,7 @@ proc recv*(socket: Socket, data: var string, size: int, timeout = -1): int = ## ## When 0 is returned the socket's connection has been closed. ## - ## This function will throw an EOS exception when an error occurs. A value + ## This function will throw an OSError exception when an error occurs. A value ## lower than 0 is never returned. ## ## A timeout may be specified in milliseconds, if enough data is not received @@ -1273,7 +1273,7 @@ proc recvLine*(socket: Socket, line: var TaintedString, timeout = -1): bool {. ## will be set to it. ## ## ``True`` is returned if data is available. ``False`` suggests an - ## error, EOS exceptions are not raised and ``False`` is simply returned + ## error, OSError exceptions are not raised and ``False`` is simply returned ## instead. ## ## If the socket is disconnected, ``line`` will be set to ``""`` and ``True`` @@ -1321,7 +1321,7 @@ proc readLine*(socket: Socket, line: var TaintedString, timeout = -1) {. ## ## If the socket is disconnected, ``line`` will be set to ``""``. ## - ## An EOS exception will be raised in the case of a socket error. + ## An OSError exception will be raised in the case of a socket error. ## ## A timeout can be specified in milliseconds, if data is not received within ## the specified time an ETimeout exception will be raised. @@ -1394,7 +1394,7 @@ proc readLineAsync*(socket: Socket, ## * If some data has been retrieved; ``ReadPartialLine`` is returned. ## * If the socket has been disconnected; ``ReadDisconnected`` is returned. ## * If no data could be retrieved; ``ReadNone`` is returned. - ## * If call to ``recv`` failed; **an EOS exception is raised.** + ## * If call to ``recv`` failed; **an OSError exception is raised.** setLen(line.string, 0) template errorOrNone = @@ -1421,7 +1421,7 @@ proc readLineAsync*(socket: Socket, proc recv*(socket: Socket): TaintedString {.tags: [ReadIOEffect], deprecated.} = ## receives all the available data from the socket. - ## Socket errors will result in an ``EOS`` error. + ## Socket errors will result in an ``OSError`` error. ## If socket is not a connectionless socket and socket is not connected ## ``""`` will be returned. ## @@ -1470,7 +1470,7 @@ proc recvAsync*(socket: Socket, s: var TaintedString): bool {. tags: [ReadIOEffect], deprecated.} = ## receives all the data from a non-blocking socket. If socket is non-blocking ## and there are no messages available, `False` will be returned. - ## Other socket errors will result in an ``EOS`` error. + ## Other socket errors will result in an ``OSError`` error. ## If socket is not a connectionless socket and socket is not connected ## ``s`` will be set to ``""``. ## @@ -1547,7 +1547,7 @@ proc recvFromAsync*(socket: Socket, data: var string, length: int, address: var string, port: var Port, flags = 0'i32): bool {.tags: [ReadIOEffect].} = ## Variant of ``recvFrom`` for non-blocking sockets. Unlike ``recvFrom``, - ## this function will raise an EOS error whenever a socket error occurs. + ## this function will raise an OSError error whenever a socket error occurs. ## ## If there is no data to be read from the socket ``False`` will be returned. result = true @@ -1622,7 +1622,7 @@ proc sendAsync*(socket: Socket, data: string): int {.tags: [WriteIOEffect].} = ## returns the amount of bytes of ``data`` that was successfully sent. This ## number may not always be the length of ``data`` but typically is. ## - ## An EOS (or ESSL if socket is an SSL socket) exception is raised if an error + ## An OSError (or SslError if socket is an SSL socket) exception is raised if an error ## occurs. result = send(socket, cstring(data), data.len) when defined(ssl): @@ -1656,7 +1656,7 @@ proc sendAsync*(socket: Socket, data: string): int {.tags: [WriteIOEffect].} = proc trySend*(socket: Socket, data: string): bool {.tags: [WriteIOEffect].} = - ## safe alternative to ``send``. Does not raise an EOS when an error occurs, + ## safe alternative to ``send``. Does not raise an OSError when an error occurs, ## and instead returns ``false`` on failure. result = send(socket, cstring(data), data.len) == data.len diff --git a/lib/packages/fsmonitor.nim b/lib/packages/fsmonitor.nim index b22e84f44..89fad4d42 100644 --- a/lib/packages/fsmonitor.nim +++ b/lib/packages/fsmonitor.nim @@ -105,7 +105,7 @@ proc add*(monitor: FSMonitor, target: string, proc del*(monitor: FSMonitor, wd: cint) = ## Removes watched directory or file as specified by ``wd`` from ``monitor``. ## - ## If ``wd`` is not a part of ``monitor`` an EOS error is raised. + ## If ``wd`` is not a part of ``monitor`` an OSError error is raised. if inotifyRmWatch(monitor.fd, wd) < 0: raiseOSError(osLastError()) diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 71a1600dc..59ef06459 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -599,7 +599,7 @@ proc listen*(socket: AsyncSocket, backlog = SOMAXCONN) {.tags: [ReadIOEffect].} ## ``Backlog`` specifies the maximum length of the ## queue of pending connections. ## - ## Raises an EOS error upon failure. + ## Raises an OSError error upon failure. if listen(socket.fd, backlog) < 0'i32: raiseOSError(osLastError()) proc bindAddr*(socket: AsyncSocket, port = Port(0), address = "") {. diff --git a/lib/pure/colors.nim b/lib/pure/colors.nim index 843f29a63..b58166b05 100644 --- a/lib/pure/colors.nim +++ b/lib/pure/colors.nim @@ -377,7 +377,7 @@ proc colorNameCmp(x: tuple[name: string, col: Color], y: string): int = proc parseColor*(name: string): Color = ## parses `name` to a color value. If no valid color could be - ## parsed ``EInvalidValue`` is raised. Case insensitive. + ## parsed ``ValueError`` is raised. Case insensitive. if name[0] == '#': result = Color(parseHexInt(name)) else: diff --git a/lib/pure/encodings.nim b/lib/pure/encodings.nim index 2039a31be..96f030c9b 100644 --- a/lib/pure/encodings.nim +++ b/lib/pure/encodings.nim @@ -302,7 +302,7 @@ proc getCurrentEncoding*(): string = proc open*(destEncoding = "UTF-8", srcEncoding = "CP1252"): EncodingConverter = ## opens a converter that can convert from `srcEncoding` to `destEncoding`. - ## Raises `EIO` if it cannot fulfill the request. + ## Raises `IOError` if it cannot fulfill the request. when not defined(windows): result = iconvOpen(destEncoding, srcEncoding) if result == nil: diff --git a/lib/pure/marshal.nim b/lib/pure/marshal.nim index 171b71493..6756107bb 100644 --- a/lib/pure/marshal.nim +++ b/lib/pure/marshal.nim @@ -254,12 +254,12 @@ proc loadAny(s: Stream, a: Any, t: var Table[BiggestInt, pointer]) = close(p) proc load*[T](s: Stream, data: var T) = - ## loads `data` from the stream `s`. Raises `EIO` in case of an error. + ## loads `data` from the stream `s`. Raises `IOError` in case of an error. var tab = initTable[BiggestInt, pointer]() loadAny(s, toAny(data), tab) proc store*[T](s: Stream, data: T) = - ## stores `data` into the stream `s`. Raises `EIO` in case of an error. + ## stores `data` into the stream `s`. Raises `IOError` in case of an error. var stored = initIntSet() var d: T shallowCopy(d, data) diff --git a/lib/pure/memfiles.nim b/lib/pure/memfiles.nim index 9fccd08d4..e5345e645 100644 --- a/lib/pure/memfiles.nim +++ b/lib/pure/memfiles.nim @@ -90,7 +90,7 @@ proc unmapMem*(f: var MemFile, p: pointer, size: int) = proc open*(filename: string, mode: FileMode = fmRead, mappedSize = -1, offset = 0, newFileSize = -1, allowRemap = false): MemFile = - ## opens a memory mapped file. If this fails, ``EOS`` is raised. + ## opens a memory mapped file. If this fails, ``OSError`` is raised. ## ## ``newFileSize`` can only be set if the file does not exist and is opened ## with write access (e.g., with fmReadWrite). @@ -141,7 +141,7 @@ proc open*(filename: string, mode: FileMode = fmRead, if result.mapHandle != 0: discard closeHandle(result.mapHandle) raiseOSError(errCode) # return false - #raise newException(EIO, msg) + #raise newException(IOError, msg) template callCreateFile(winApiProc, filename): untyped = winApiProc( @@ -465,7 +465,7 @@ proc mmsWriteData(s: Stream, buffer: pointer, bufLen: int) = proc newMemMapFileStream*(filename: string, mode: FileMode = fmRead, fileSize: int = -1): MemMapFileStream = ## creates a new stream from the file named `filename` with the mode `mode`. - ## Raises ## `EOS` if the file cannot be opened. See the `system + ## Raises ## `OSError` if the file cannot be opened. See the `system ## <system.html>`_ module for a list of available FileMode enums. ## ``fileSize`` can only be set if the file does not exist and is opened ## with write access (e.g., with fmReadWrite). diff --git a/lib/pure/nativesockets.nim b/lib/pure/nativesockets.nim index 514b8d66a..b091f7310 100644 --- a/lib/pure/nativesockets.nim +++ b/lib/pure/nativesockets.nim @@ -221,7 +221,7 @@ proc close*(socket: SocketHandle) = discard winlean.closesocket(socket) else: discard posix.close(socket) - # TODO: These values should not be discarded. An EOS should be raised. + # TODO: These values should not be discarded. An OSError should be raised. # http://stackoverflow.com/questions/12463473/what-happens-if-you-call-close-on-a-bsd-socket-multiple-times proc bindAddr*(socket: SocketHandle, name: ptr SockAddr, namelen: SockLen): cint = @@ -594,7 +594,7 @@ proc setSockOptInt*(socket: SocketHandle, level, optname, optval: int) {. proc setBlocking*(s: SocketHandle, blocking: bool) = ## Sets blocking mode on socket. ## - ## Raises EOS on error. + ## Raises OSError on error. when useWinVersion: var mode = clong(ord(not blocking)) # 1 for non-blocking, 0 for blocking if ioctlsocket(s, FIONBIO, addr(mode)) == -1: diff --git a/lib/pure/net.nim b/lib/pure/net.nim index 179fccaa3..23cd96b20 100644 --- a/lib/pure/net.nim +++ b/lib/pure/net.nim @@ -210,7 +210,7 @@ proc newSocket*(fd: SocketHandle, domain: Domain = AF_INET, proc newSocket*(domain, sockType, protocol: cint, buffered = true): Socket = ## Creates a new socket. ## - ## If an error occurs EOS will be raised. + ## If an error occurs OSError will be raised. let fd = createNativeSocket(domain, sockType, protocol) if fd == osInvalidSocket: raiseOSError(osLastError()) @@ -221,7 +221,7 @@ proc newSocket*(domain: Domain = AF_INET, sockType: SockType = SOCK_STREAM, protocol: Protocol = IPPROTO_TCP, buffered = true): Socket = ## Creates a new socket. ## - ## If an error occurs EOS will be raised. + ## If an error occurs OSError will be raised. let fd = createNativeSocket(domain, sockType, protocol) if fd == osInvalidSocket: raiseOSError(osLastError()) @@ -229,7 +229,7 @@ proc newSocket*(domain: Domain = AF_INET, sockType: SockType = SOCK_STREAM, proc parseIPv4Address(addressStr: string): IpAddress = ## Parses IPv4 adresses - ## Raises EInvalidValue on errors + ## Raises ValueError on errors var byteCount = 0 currentByte:uint16 = 0 @@ -263,7 +263,7 @@ proc parseIPv4Address(addressStr: string): IpAddress = proc parseIPv6Address(addressStr: string): IpAddress = ## Parses IPv6 adresses - ## Raises EInvalidValue on errors + ## Raises ValueError on errors result.family = IpAddressFamily.IPv6 if addressStr.len < 2: raise newException(ValueError, "Invalid IP Address") @@ -384,7 +384,7 @@ proc parseIPv6Address(addressStr: string): IpAddress = proc parseIpAddress*(addressStr: string): IpAddress = ## Parses an IP address - ## Raises EInvalidValue on error + ## Raises ValueError on error if addressStr.len == 0: raise newException(ValueError, "IP Address string is empty") if addressStr.contains(':'): @@ -746,7 +746,7 @@ proc listen*(socket: Socket, backlog = SOMAXCONN) {.tags: [ReadIOEffect].} = ## ``Backlog`` specifies the maximum length of the ## queue of pending connections. ## - ## Raises an EOS error upon failure. + ## Raises an OSError error upon failure. if nativesockets.listen(socket.fd, backlog) < 0'i32: raiseOSError(osLastError()) @@ -777,7 +777,7 @@ proc acceptAddr*(server: Socket, client: var Socket, address: var string, ## Blocks until a connection is being made from a client. When a connection ## is made sets ``client`` to the client socket and ``address`` to the address ## of the connecting client. - ## This function will raise EOS if an error occurs. + ## This function will raise OSError if an error occurs. ## ## The resulting client will inherit any properties of the server socket. For ## example: whether the socket is buffered or not. @@ -983,7 +983,7 @@ when defined(ssl): ## Returns ``False`` whenever the socket is not yet ready for a handshake, ## ``True`` whenever handshake completed successfully. ## - ## A ESSL error is raised on any other errors. + ## A SslError error is raised on any other errors. ## ## **Note:** This procedure is deprecated since version 0.14.0. result = true @@ -1011,7 +1011,7 @@ when defined(ssl): ## Determines whether a handshake has occurred between a client (``socket``) ## and the server that ``socket`` is connected to. ## - ## Throws ESSL if ``socket`` is not an SSL socket. + ## Throws SslError if ``socket`` is not an SSL socket. if socket.isSSL: return not socket.sslNoHandshake else: @@ -1203,7 +1203,7 @@ proc recv*(socket: Socket, size: int, timeout = -1, ## ## When ``""`` is returned the socket's connection has been closed. ## - ## This function will throw an EOS exception when an error occurs. + ## This function will throw an OSError exception when an error occurs. ## ## A timeout may be specified in milliseconds, if enough data is not received ## within the time specified an ETimeout exception will be raised. @@ -1244,7 +1244,7 @@ proc readLine*(socket: Socket, line: var TaintedString, timeout = -1, ## ## If the socket is disconnected, ``line`` will be set to ``""``. ## - ## An EOS exception will be raised in the case of a socket error. + ## An OSError exception will be raised in the case of a socket error. ## ## A timeout can be specified in milliseconds, if data is not received within ## the specified time an ETimeout exception will be raised. @@ -1299,7 +1299,7 @@ proc recvLine*(socket: Socket, timeout = -1, ## ## If the socket is disconnected, the result will be set to ``""``. ## - ## An EOS exception will be raised in the case of a socket error. + ## An OSError exception will be raised in the case of a socket error. ## ## A timeout can be specified in milliseconds, if data is not received within ## the specified time an ETimeout exception will be raised. @@ -1317,7 +1317,7 @@ proc recvFrom*(socket: Socket, data: var string, length: int, ## Receives data from ``socket``. This function should normally be used with ## connection-less sockets (UDP sockets). ## - ## If an error occurs an EOS exception will be raised. Otherwise the return + ## If an error occurs an OSError exception will be raised. Otherwise the return ## value will be the length of data received. ## ## **Warning:** This function does not yet have a buffered implementation, @@ -1390,7 +1390,7 @@ template `&=`*(socket: Socket; data: typed) = send(socket, data) proc trySend*(socket: Socket, data: string): bool {.tags: [WriteIOEffect].} = - ## Safe alternative to ``send``. Does not raise an EOS when an error occurs, + ## Safe alternative to ``send``. Does not raise an OSError when an error occurs, ## and instead returns ``false`` on failure. result = send(socket, cstring(data), data.len) == data.len diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index e487a8975..dfea4213d 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -121,7 +121,7 @@ proc startProcess*(command: string, ## invocation if possible as it leads to non portable software. ## ## Return value: The newly created process object. Nil is never returned, - ## but ``EOS`` is raised in case of an error. + ## but ``OSError`` is raised in case of an error. proc startCmd*(command: string, options: set[ProcessOption] = { poStdErrToStdOut, poUsePath}): Process {. diff --git a/lib/pure/parseutils.nim b/lib/pure/parseutils.nim index 80e67b58f..f68baaf6b 100644 --- a/lib/pure/parseutils.nim +++ b/lib/pure/parseutils.nim @@ -267,7 +267,7 @@ proc parseBiggestInt*(s: string, number: var BiggestInt, start = 0): int {. rtl, extern: "npuParseBiggestInt", noSideEffect.} = ## parses an integer starting at `start` and stores the value into `number`. ## Result is the number of processed chars or 0 if there is no integer. - ## `EOverflow` is raised if an overflow occurs. + ## `OverflowError` is raised if an overflow occurs. var res: BiggestInt # use 'res' for exception safety (don't write to 'number' in case of an # overflow exception): diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim index 3ee82917d..3909d18f8 100644 --- a/lib/pure/pegs.nim +++ b/lib/pure/pegs.nim @@ -1342,7 +1342,7 @@ when not defined(js): subs: varargs[tuple[pattern: Peg, repl: string]]) {. rtl, extern: "npegs$1".} = ## reads in the file `infile`, performs a parallel replacement (calls - ## `parallelReplace`) and writes back to `outfile`. Raises ``EIO`` if an + ## `parallelReplace`) and writes back to `outfile`. Raises ``IOError`` if an ## error occurs. This is supposed to be used for quick scripting. ## ## **Note**: this proc does not exist while using the JS backend. diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 9950c5877..b0ac62525 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -157,112 +157,112 @@ proc peek[T](s: Stream, result: var T) = raise newEIO("cannot read from stream") proc readChar*(s: Stream): char = - ## reads a char from the stream `s`. Raises `EIO` if an error occurred. + ## reads a char from the stream `s`. Raises `IOError` if an error occurred. ## Returns '\\0' as an EOF marker. if readData(s, addr(result), sizeof(result)) != 1: result = '\0' proc peekChar*(s: Stream): char = - ## peeks a char from the stream `s`. Raises `EIO` if an error occurred. + ## peeks a char from the stream `s`. Raises `IOError` if an error occurred. ## Returns '\\0' as an EOF marker. if peekData(s, addr(result), sizeof(result)) != 1: result = '\0' proc readBool*(s: Stream): bool = - ## reads a bool from the stream `s`. Raises `EIO` if an error occurred. + ## reads a bool from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekBool*(s: Stream): bool = - ## peeks a bool from the stream `s`. Raises `EIO` if an error occurred. + ## peeks a bool from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readInt8*(s: Stream): int8 = - ## reads an int8 from the stream `s`. Raises `EIO` if an error occurred. + ## reads an int8 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekInt8*(s: Stream): int8 = - ## peeks an int8 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks an int8 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readInt16*(s: Stream): int16 = - ## reads an int16 from the stream `s`. Raises `EIO` if an error occurred. + ## reads an int16 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekInt16*(s: Stream): int16 = - ## peeks an int16 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks an int16 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readInt32*(s: Stream): int32 = - ## reads an int32 from the stream `s`. Raises `EIO` if an error occurred. + ## reads an int32 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekInt32*(s: Stream): int32 = - ## peeks an int32 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks an int32 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readInt64*(s: Stream): int64 = - ## reads an int64 from the stream `s`. Raises `EIO` if an error occurred. + ## reads an int64 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekInt64*(s: Stream): int64 = - ## peeks an int64 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks an int64 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readUint8*(s: Stream): uint8 = - ## reads an uint8 from the stream `s`. Raises `EIO` if an error occurred. + ## reads an uint8 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekUint8*(s: Stream): uint8 = - ## peeks an uint8 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks an uint8 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readUint16*(s: Stream): uint16 = - ## reads an uint16 from the stream `s`. Raises `EIO` if an error occurred. + ## reads an uint16 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekUint16*(s: Stream): uint16 = - ## peeks an uint16 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks an uint16 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readUint32*(s: Stream): uint32 = - ## reads an uint32 from the stream `s`. Raises `EIO` if an error occurred. + ## reads an uint32 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekUint32*(s: Stream): uint32 = - ## peeks an uint32 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks an uint32 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readUint64*(s: Stream): uint64 = - ## reads an uint64 from the stream `s`. Raises `EIO` if an error occurred. + ## reads an uint64 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekUint64*(s: Stream): uint64 = - ## peeks an uint64 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks an uint64 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readFloat32*(s: Stream): float32 = - ## reads a float32 from the stream `s`. Raises `EIO` if an error occurred. + ## reads a float32 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekFloat32*(s: Stream): float32 = - ## peeks a float32 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks a float32 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readFloat64*(s: Stream): float64 = - ## reads a float64 from the stream `s`. Raises `EIO` if an error occurred. + ## reads a float64 from the stream `s`. Raises `IOError` if an error occurred. read(s, result) proc peekFloat64*(s: Stream): float64 = - ## peeks a float64 from the stream `s`. Raises `EIO` if an error occurred. + ## peeks a float64 from the stream `s`. Raises `IOError` if an error occurred. peek(s, result) proc readStr*(s: Stream, length: int): TaintedString = - ## reads a string of length `length` from the stream `s`. Raises `EIO` if + ## reads a string of length `length` from the stream `s`. Raises `IOError` if ## an error occurred. result = newString(length).TaintedString var L = readData(s, cstring(result), length) if L != length: setLen(result.string, L) proc peekStr*(s: Stream, length: int): TaintedString = - ## peeks a string of length `length` from the stream `s`. Raises `EIO` if + ## peeks a string of length `length` from the stream `s`. Raises `IOError` if ## an error occurred. result = newString(length).TaintedString var L = peekData(s, cstring(result), length) @@ -301,7 +301,7 @@ proc peekLine*(s: Stream, line: var TaintedString): bool = proc readLine*(s: Stream): TaintedString = ## Reads a line from a stream `s`. Note: This is not very efficient. Raises - ## `EIO` if an error occurred. + ## `IOError` if an error occurred. result = TaintedString"" if s.atEnd: raise newEIO("cannot read from stream") @@ -317,7 +317,7 @@ proc readLine*(s: Stream): TaintedString = proc peekLine*(s: Stream): TaintedString = ## Peeks a line from a stream `s`. Note: This is not very efficient. Raises - ## `EIO` if an error occurred. + ## `IOError` if an error occurred. let pos = getPosition(s) defer: setPosition(s, pos) result = readLine(s) diff --git a/lib/system.nim b/lib/system.nim index 5ff9ffbeb..05ffa63b4 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1786,26 +1786,26 @@ type # these work for most platforms: proc toFloat*(i: int): float {. magic: "ToFloat", noSideEffect, importc: "toFloat".} ## converts an integer `i` into a ``float``. If the conversion - ## fails, `EInvalidValue` is raised. However, on most platforms the + ## fails, `ValueError` is raised. However, on most platforms the ## conversion cannot fail. proc toBiggestFloat*(i: BiggestInt): BiggestFloat {. magic: "ToBiggestFloat", noSideEffect, importc: "toBiggestFloat".} ## converts an biggestint `i` into a ``biggestfloat``. If the conversion - ## fails, `EInvalidValue` is raised. However, on most platforms the + ## fails, `ValueError` is raised. However, on most platforms the ## conversion cannot fail. proc toInt*(f: float): int {. magic: "ToInt", noSideEffect, importc: "toInt".} ## converts a floating point number `f` into an ``int``. Conversion ## rounds `f` if it does not contain an integer value. If the conversion - ## fails (because `f` is infinite for example), `EInvalidValue` is raised. + ## fails (because `f` is infinite for example), `ValueError` is raised. proc toBiggestInt*(f: BiggestFloat): BiggestInt {. magic: "ToBiggestInt", noSideEffect, importc: "toBiggestInt".} ## converts a biggestfloat `f` into a ``biggestint``. Conversion ## rounds `f` if it does not contain an integer value. If the conversion - ## fails (because `f` is infinite for example), `EInvalidValue` is raised. + ## fails (because `f` is infinite for example), `ValueError` is raised. proc addQuitProc*(QuitProc: proc() {.noconv.}) {. importc: "atexit", header: "<stdlib.h>".} @@ -3475,7 +3475,7 @@ when not defined(JS): #and not defined(nimscript): iterator lines*(filename: string): TaintedString {.tags: [ReadIOEffect].} = ## Iterates over any line in the file named `filename`. ## - ## If the file does not exist `EIO` is raised. The trailing newline + ## If the file does not exist `IOError` is raised. The trailing newline ## character(s) are removed from the iterated lines. Example: ## ## .. code-block:: nim |