WriteError class: Difference between revisions
(Created page with "This page is under construction. __NOTOC__ WriteError exceptions are typically thrown by the Parse function in the WriteError class when...") |
m (provide content) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
WriteError exceptions are | <var>WriteError</var> exceptions are thrown by the <var>Close</var>, <var>WriteBlock</var>, <var>WriteRecord</var>, and <var>WriteRecords</var> methods in the [[Dataset class]] if they encounter a full dataset. The problem with this approach is if the dataset fills on your last write or maybe on the Close (since Close flushes buffers and checks pending writes) you might never notice that your dataset filled up. Silently, allowing a dataset to be truncated doesn’t seem like a good idea. | ||
To create a <var>WriteError</var> exception yourself, you typically use a SOUL <var>[[Exceptions#Using the Throw statement|Throw]]</var> statement with an <var>WriteError</var> <var>[[New_(WriteError_constructor)|New]]</var> constructor. | To create a <var>WriteError</var> exception yourself, you typically use a SOUL <var>[[Exceptions#Using the Throw statement|Throw]]</var> statement with an <var>WriteError</var> <var>[[New_(WriteError_constructor)|New]]</var> constructor. This statement must be issued from within a method, and it can only be caught by the code that calls the method. For example, the following statement throws a <var>WriteError</var> exception: | ||
<p class="code">throw %(WriteError):new( | <p class="code">throw %(WriteError):new(returnCode=%rc) | ||
</p> | </p> | ||
Remember that you catch an exception with the <var>[[Exceptions#Try and Catch|Catch]]</var> statement | Remember that you catch an exception with the <var>[[Exceptions#Try and Catch|Catch]]</var> statement. If an exception condition occurs outside a <var>Catch</var> for it, the request is canceled. | ||
The <var>WriteError</var> | The <var>WriteError</var> class is available as of <var class="product">Model 204</var> 7.7. | ||
==The WriteError methods== | ==The WriteError methods== | ||
Line 17: | Line 15: | ||
The methods in the class are described in the subsections that follow. In addition: | The methods in the class are described in the subsections that follow. In addition: | ||
<ul> | <ul> | ||
<li>[[Notation conventions for methods | <li>[[Notation conventions for methods]] has information | ||
about the conventions followed. | about the conventions followed. </li> | ||
<li>[[WriteError methods syntax | |||
<li>[[WriteError methods syntax]] is a single page that contains the syntax diagrams of all the methods in the class. </li> | |||
</ul> | </ul> | ||
== | |||
{{Template:WriteError: | ==ReturnCode property== | ||
{{Template:WriteError:ReturnCode subtitle}} | |||
This <var>[[Classes and Objects#readWrite|ReadOnly]]</var> property returns a number that indicates the | This <var>[[Classes and Objects#readWrite|ReadOnly]]</var> property returns a number that indicates the type of error encountered. | ||
===Syntax=== | ===Syntax=== | ||
{{Template:WriteError: | {{Template:WriteError:ReturnCode syntax}} | ||
====Syntax terms==== | ====Syntax terms==== | ||
<table | <table> | ||
<tr><th>%number</th> | <tr><th>%number</th> | ||
<td>The | <td>An I/O error return code. The most likely codes are: | ||
<p class="codeInTable"> 4 Permanent I/O error | |||
10 Offload process failed | |||
12 File full condition </p> | |||
</td></tr> | |||
<tr><th> | <tr><th>writeError</th> | ||
<td>A reference to an instance of a <var>[[WriteError_class|WriteError]]</var> object.</td></tr> | <td>A reference to an instance of a <var>[[WriteError_class|WriteError]]</var> object.</td></tr> | ||
</table> | </table> | ||
==New constructor== | ==New constructor== | ||
{{Template:WriteError:New subtitle}} | {{Template:WriteError:New subtitle}} | ||
This <var>Constructor</var> generates an instance of a <var>[[WriteError_class|WriteError]]</var> exception. | This <var>Constructor</var> generates an instance of a <var>[[WriteError_class|WriteError]]</var> exception. | ||
===Syntax=== | ===Syntax=== | ||
{{Template:WriteError:New syntax}} | {{Template:WriteError:New syntax}} | ||
Line 62: | Line 53: | ||
====Syntax terms==== | ====Syntax terms==== | ||
<table> | <table> | ||
<tr><th>% | <tr><th>%writeError</th> | ||
<tr><th><var>[%(WriteError):]</var></th><td>The class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>.</td></tr> | <td>A reference to an instance of a <var>WriteError</var> object.</td></tr> | ||
<tr><th>number</th><td> | |||
<tr><th><var>[%(WriteError):]</var></th> | |||
<td>The class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>.</td></tr> | |||
<tr><th>number</th> | |||
<td>A <var>ReturnCode</var> property value that indicates the type of error encountered.</td></tr> | |||
</table> | </table> | ||
[[Category:System exception classes]] | [[Category:System exception classes]] |
Revision as of 16:47, 9 August 2016
WriteError exceptions are thrown by the Close, WriteBlock, WriteRecord, and WriteRecords methods in the Dataset class if they encounter a full dataset. The problem with this approach is if the dataset fills on your last write or maybe on the Close (since Close flushes buffers and checks pending writes) you might never notice that your dataset filled up. Silently, allowing a dataset to be truncated doesn’t seem like a good idea.
To create a WriteError exception yourself, you typically use a SOUL Throw statement with an WriteError New constructor. This statement must be issued from within a method, and it can only be caught by the code that calls the method. For example, the following statement throws a WriteError exception:
throw %(WriteError):new(returnCode=%rc)
Remember that you catch an exception with the Catch statement. If an exception condition occurs outside a Catch for it, the request is canceled.
The WriteError class is available as of Model 204 7.7.
The WriteError methods
The following are the available WriteError class methods.
Method | Description |
---|---|
New | Create a new WriteError object |
ReturnCode | Return code from failed write |
The methods in the class are described in the subsections that follow. In addition:
- Notation conventions for methods has information about the conventions followed.
- WriteError methods syntax is a single page that contains the syntax diagrams of all the methods in the class.
ReturnCode property
Return code from failed write (WriteError class)
This ReadOnly property returns a number that indicates the type of error encountered.
Syntax
%number = writeError:ReturnCode
Syntax terms
%number | An I/O error return code. The most likely codes are:
4 Permanent I/O error 10 Offload process failed 12 File full condition |
---|---|
writeError | A reference to an instance of a WriteError object. |
New constructor
Create a new WriteError object (WriteError class)
This Constructor generates an instance of a WriteError exception.
Syntax
%writeError = [%(WriteError):]New( ReturnCode= number)
Syntax terms
%writeError | A reference to an instance of a WriteError object. |
---|---|
[%(WriteError):] | The class name in parentheses denotes a Constructor. |
number | A ReturnCode property value that indicates the type of error encountered. |