Skip to content

Commit 074309f

Browse files
committed
Simplify logic
1 parent 7b3deba commit 074309f

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

nxc/modules/webdav.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,18 @@ def on_login(self, context, connection):
3838
remote_file.open_file()
3939

4040
context.log.highlight(self.output.format(connection.conn.getRemoteHost()))
41-
4241
except SessionError as e:
4342
if e.getErrorCode() == nt_errors.STATUS_OBJECT_NAME_NOT_FOUND:
4443
return
45-
46-
if e.getErrorCode() in nt_errors.ERROR_MESSAGES:
44+
elif e.getErrorCode() in nt_errors.ERROR_MESSAGES:
4745
context.log.fail(f"Error enumerating WebDAV: {e.getErrorString()[0]}", color="magenta")
4846
return
49-
50-
context.log.debug(f"WebDAV SessionError (code={hex(e.getErrorCode())})")
47+
else:
48+
context.log.debug(f"WebDAV SessionError (code={hex(e.getErrorCode())})")
5149
return
52-
5350
except (BrokenPipeError, ConnectionResetError, NetBIOSError, OSError) as e:
5451
context.log.debug(f"WebDAV check aborted due to transport error: {e.__class__.__name__}: {e}")
5552
return
56-
5753
finally:
5854
with contextlib.suppress(Exception):
5955
remote_file.close()

0 commit comments

Comments
 (0)