Documentation Center

Exception Handling

Any compilation error during the load form process or any exception occurring in the event handling during runtime of the client script raises a Script Failure.

The Script Failure message reports: Script could not be loaded.

The Detail button displays more information about the error message, the code location or which piece of code caused the error.

The following code sample shows a script section written in Visual Basic that synchronizes the description field while entering the title field when changing the properties of an object. A syntax error is made in Public Sub Field_ValueChanged(ByVal sender as Object, ByVal e As EventArg) (annotated in bold)
<script language="Visual Basic">
	<![CDATA[
		Public Subhield_ValueChanged(ByVal sender as Object, ByVal e As EventArg
		Try
		Me.Form.Fields("DescriptionField").SerializedValue = Me.DisplayText
		Catch ex As Exception
			System.Windows.Forms.MessageBox.Show(ex.ToString())
		End Try
		End Sub
	]]>
</script>

The detail view shows what caused the error

and shows the code location or which piece of code caused the error.

====== Build failed with 7 errors. ======

1.  Error BC30201 (1, 0): Expression expected.
2.  Error BC30689 (2, 0): Statement cannot appear outside of a method body.
3.  Error BC30035 (3, 0): Syntax error.
4.  Error BC30689 (4, 0): Statement cannot appear outside of a method body.
5.  Error BC30188 (5, 0): Declaration expected.
6.  Error BC30383 (6, 0): 'End Try' must be preceded by a matching 'Try'.
7.  Error BC30429 (7, 0): 'End Sub' must be preceded by a matching 'Sub'.

------ Script begin ------

Public Subhield_ValueChanged(ByVal sender as Object, ByVal e As EventArgs)
Try
Me.Form.Fields("DescriptionField").SerializedValue = Me.DisplayText
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString())
End Try
End Sub
                                                               
------ Script end ------