C H A P T E R 2 3
Using the Endpoint Interface
) method returns, and any pending
synchronous request is canceled by throwing an exception that contains error code
16005. Or, if the cancellation was invoked as the result of a time-out expiration,
then whatever method timed out throws an exception containing error code 16005.
method allows you to get and set options apart from the options
parameter to the
You can check the state of a connection by calling the
Custom communication tools can return special events to the endpoint object
message. This message is sent to the endpoint
whenever an event occurs that is not handled by one of the usual endpoint event
handlers. A custom communication tool and an endpoint can use this mechanism to
pass events from the communication tool up to the endpoint layer.
By specifying an
method in your endpoint, you can handle
exception conditions not caught by local
clauses, as well
as exceptions not caught by
When you call an endpoint method synchronously, and an error occurs in that
method, the system throws an exception (usually of type
can catch these exceptions in your application by using the
. . .
construct. It's a good idea to bracket every endpoint method call
with this exception catching construct.
If an error occurs as a result of an asynchronous request, no exception is thrown,
but the error is returned in the result parameter to the
method associated with that request. If you did not define a
method, or if the error is unsolicited, the error is forwarded to your
method. If you did not define an
method, then the communication system throws an exception. This exception is
caught by the operating system, which displays a warning message to the user.
Constants for error codes generated by the Endpoint interface are defined in
"Endpoint Error Code Constants" (Table 20-4 on page 20-4) in Newton
When you use the
method (or any method that takes options as a
parameter), not only can the method itself fail, but a failure can occur in processing
each of the individual option requests. If the latter happens, the
slot in the
returned option frame is set to one of the option error codes listed in "Option Error
Code Constants" (Table 20-5 on page 20-5) in Newton Programmer's Reference. If