Skip to content

Commit

Permalink
fixes bareExcept warnings; catch specific exceptions (#21119)
Browse files Browse the repository at this point in the history
* fixes bareExcept warnings; catch specific exceptions

* Update lib/pure/coro.nim
  • Loading branch information
ringabout committed Aug 12, 2023
1 parent 4c89223 commit 9207d77
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/pure/asynchttpserver.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/std/private/osdirs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions lib/std/private/osfiles.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 9207d77

Please sign in to comment.