mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes bareExcept warnings; catch specific exceptions (#21119)
* fixes bareExcept warnings; catch specific exceptions * Update lib/pure/coro.nim
This commit is contained in:
@@ -381,7 +381,7 @@ const
|
||||
proc listen*(server: AsyncHttpServer; port: Port; address = ""; domain = AF_INET) =
|
||||
## Listen to the given port and address.
|
||||
when declared(maxDescriptors):
|
||||
server.maxFDs = try: maxDescriptors() except: nimMaxDescriptorsFallback
|
||||
server.maxFDs = try: maxDescriptors() except OSError: nimMaxDescriptorsFallback
|
||||
else:
|
||||
server.maxFDs = nimMaxDescriptorsFallback
|
||||
server.socket = newAsyncSocket(domain)
|
||||
|
||||
@@ -515,7 +515,7 @@ proc copyDirWithPermissions*(source, dest: string,
|
||||
try:
|
||||
setFilePermissions(dest, getFilePermissions(source), followSymlinks =
|
||||
false)
|
||||
except:
|
||||
except OSError:
|
||||
if not ignorePermissionErrors:
|
||||
raise
|
||||
for kind, path in walkDir(source):
|
||||
|
||||
@@ -311,7 +311,7 @@ proc copyFileWithPermissions*(source, dest: string,
|
||||
try:
|
||||
setFilePermissions(dest, getFilePermissions(source), followSymlinks =
|
||||
(cfSymlinkFollow in options))
|
||||
except:
|
||||
except OSError:
|
||||
if not ignorePermissionErrors:
|
||||
raise
|
||||
|
||||
@@ -402,6 +402,6 @@ proc moveFile*(source, dest: string) {.rtl, extern: "nos$1",
|
||||
copyFile(source, dest, {cfSymlinkAsIs})
|
||||
try:
|
||||
removeFile(source)
|
||||
except:
|
||||
except OSError:
|
||||
discard tryRemoveFile(dest)
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user