. Error Handling
|
Compare the
following code fragments:
If
Bug_Fields(“BG_SEVERITY”).Value = “4-Urgent” Then
Bug_Fields(“BG_PRIORITY”).Value =
“4-Urgent”
End If
|
On Error Resume
Next
...
If
Bug_Fields(“BG_SEVERITY”).Value = “4-Urgent” Then
Bug_Fields(“BG_PRIORITY”).Value =
“4-Urgent”
End If
...
PrintError
“SomeSub”
On Error GoTo 0
|
The both code
fragments will work the same way when no problems arise during the code
execution. But what happens if, for example, the user has no permissions to
modify BG_PRIORITY field? The left fragment will not update the field and will
cause the browser crash. The second will not update the field, but it will show
the correct error to the user and the browser will not crash.
No comments:
Post a Comment