wolph/portalocker

which cases would lead to exception in unlock

ZhuYuJin opened this issue · 2 comments

I find unlock function tries to catch several exceptions. However, which cases would lead to exception in unlock? Could you give some examples?

Should we always use unlock with try...catch?

image

wolph commented

Honestly... I'm not entirely sure. They are mostly there as failsafes.

A few cases where exceptions could be raised:

  1. IOError due to the filesystem being unavailable for some reason... not sure if this ever really happens
  2. Releasing a lock multiple times

In general I would say that these errors shouldn't occur and if they do, you want to know about them.

wolph commented

The locking mechanism for windows has been rewritten and simplified. It should always raise a LockException with the details about the original exception so I believe this issue is no long relevant.