Is it appropriate to use System.Exception in this situation?

He usually frowned at using System.Exception, but I wonder if this is my only choice.

I have this script

  • User requests a task for editing.
  • Permission checks are in progress.
  • If a good task line from db is selected
  • Then, an update is performed for the task and the column is updated to say that it is locked.
  • Some time zone information is applied to this task to convert dates to local time.
  • The task is displayed to the user.

So, if something happens between steps 1 through 4, the task is still good, as it is not blocked. However, if it does not work in step 5, and I cannot display the task for the user, the file is locked and will be locked until the scheduled task is completed to ensure that the locked files are locked.

This type is not ideal, as it may be a temporary failure, and the next time they ask for a file, it may work again. But now they have to wait (the same with all the other subscribers) X minutes before automatic unlocking.

So, my first thought was to use the finally expression, but it always starts regardless of the fact that I could not figure out how to say that the file is now locked, do not worry about unlocking it.

, - , . , # , .

, , , - , . , SQl, -, .

, elmah, , .

- ?

+3
2

. . , . ---- , .

+4

System.Exception , , , . , System.Exception - , , , , - , , System.Exception , , .. .

, "- ", 5, , , , , , , .

, , -, , , finally? , , noop.

+2

All Articles