InvalidSortSpecification class: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 7: Line 7:
This exception class has no properties.
This exception class has no properties.
The class's only method is the <var>[[#New constructor|New]]</var> constructor, which you would typically use with a <var class="product">User Language</var> <var>[[Throw statement|Throw]]</var> statement to produce an <var>InvalidSortSpecification</var> exception. For example:
The class's only method is the <var>[[#New constructor|New]]</var> constructor, which you would typically use with a <var class="product">User Language</var> <var>[[Throw statement|Throw]]</var> statement to produce an <var>InvalidSortSpecification</var> exception. For example:
<p class="code"> throw %(invalidSortSpecification):new
<p class="code">throw %(invalidSortSpecification):new
</p>
</p>
   
   
Line 13: Line 13:
<var>Catch</var> for it, the request is cancelled.
<var>Catch</var> for it, the request is cancelled.


Actually, the <var>InvalidSortSpecification</var> is rarely used.  One possible circumstance for using it would be if a sort specification is entered (at least in
Actually, the <var>InvalidSortSpecification</var> is rarely used.  One possible occasion for using it would be a sort specification entered (at least in
part) by an end user, and then a <code>[[Try statement|try]].../catch&nbsp;invalidSortSpecification</code> block might be appropriate, as shown here:
part) by an end user. In this case, a <code>try.../catch&nbsp;invalidSortSpecification</code> block might be appropriate:
<p class="code"> %sortSpec = $read('Enter sort specification')
<p class="code">%sortSpec = $read('Enter sort specification')
try %strlist:sort(%sortSpec)
[[Try statement|try]] %strlist:sort(%sortSpec)
catch invalidSortSpecification
catch invalidSortSpecification
    Print 'Invalid ...'
  Print 'Invalid ...'
    ...
  ...
end try
end try
</p>
</p>
In most cases, however, a sort specification is explicitly coded in the <var>User Language</var> request (for example, rather than <code>%sortSpec&nbsp;=&nbsp;$read...</code> as above, something like <code>%sortSpec&nbsp;=&nbsp;'1,10,CH,A'</code>), and so the sort specification should
In most cases, however, a sort specification is explicitly coded in the <var>User Language</var> request (for example, rather than <code>%sortSpec&nbsp;=&nbsp;$read...</code> as above, something like <code>%sortSpec&nbsp;=&nbsp;'1,10,CH,A'</code>). Such a sort specification should
always be correct and request cancellation is an appropriate action, that is, <b>do not</b> use the <code>try.../catch</code> block as above.
be correct in all circumstances, and if it is not, request cancellation (<b>not</b> a <code>try.../catch</code> block) is the appropriate action.
   
   
The <var>InvalidSortSpecification</var> class is available as of <var class="product">[[Category:System exception classes]]</var> version 7.9.
The <var>InvalidSortSpecification</var> class is available as of <var class="product">[[Category:System exception classes]]</var> version 7.9.

Revision as of 21:22, 9 June 2011


An InvalidSortSpecification exception indicates that the first argument provided to either the Sort or SortNew method (in the Stringlist class) is not a valid sort specification.

This exception class has no properties. The class's only method is the New constructor, which you would typically use with a User Language Throw statement to produce an InvalidSortSpecification exception. For example:

throw %(invalidSortSpecification):new

Remember that catching an exception is done with the Catch statement; if an exception condition occurs outside a Catch for it, the request is cancelled.

Actually, the InvalidSortSpecification is rarely used. One possible occasion for using it would be a sort specification entered (at least in part) by an end user. In this case, a try.../catch invalidSortSpecification block might be appropriate:

%sortSpec = $read('Enter sort specification') try %strlist:sort(%sortSpec) catch invalidSortSpecification Print 'Invalid ...' ... end try

In most cases, however, a sort specification is explicitly coded in the User Language request (for example, rather than %sortSpec = $read... as above, something like %sortSpec = '1,10,CH,A'). Such a sort specification should be correct in all circumstances, and if it is not, request cancellation (not a try.../catch block) is the appropriate action.

The InvalidSortSpecification class is available as of version 7.9.


The InvalidSortSpecification methods

The following are the available InvalidSortSpecification class methods.

MethodDescription
NewCreate a new InvalidSortSpecification object

The methods in the class are described in the subsections that follow. In addition:


New constructor

Create a new InvalidSortSpecification object (InvalidSortSpecification class)

[Introduced in Sirius Mods 7.9]

This callable constructor generates an instance of an InvalidSortSpecification exception. The New constructor format follows:

Syntax

%invalidSortSpecification = [%(InvalidSortSpecification):]New

Syntax terms

%invalidSortSpecification An InvalidSortSpecification %variable which will refer to the newly created object.
%(InvalidSortSpecification)The class name in parentheses denotes a shared method. New can also be invoked via an InvalidSortSpecification object variable.