Lingo Dictionary > L-N > netError() |  |

netError()

Syntax

    netError()
    netError(netID)

Description

Function; determines whether an error has occurred in a network operation and, if so, returns an error number corresponding to an error message. If the operation was successful, this function returns a code indicating that everything is fine. If no background loading operation has started, or if the operation is in progress, this function returns an empty string.

| Use `netError()` to test the last network operation.
| Use `netError(``netID``)` to test the network operation specified by `netID`.

Several possible error codes may be returned:

OK | Everything is fine.
4 | Bad MOA class. The required network or nonnetwork Xtras are improperly installed or not installed at all.
5 | Bad MOA Interface. See 4.
6 | Bad URL or Bad MOA class. The required network or nonnetwork Xtras are improperly installed or not installed at all.
20 | Internal error. Returned by `netError()` in the Netscape browser if the browser detected a network or internal error.
4146 | Connection could not be established with the remote host.
4149 | Data supplied by the server was in an unexpected format.
4150 | Unexpected early closing of connection.
4154 | Operation could not be completed due to timeout.
4155 | Not enough memory available to complete the transaction.
4156 | Protocol reply to request indicates an error in the reply.
4157 | Transaction failed to be authenticated.
4159 | Invalid URL.
4164 | Could not create a socket.
4165 | Requested object could not be found (URL may be incorrect).
4166 | Generic proxy failure.
4167 | Transfer was intentionally interrupted by client.
4242 | Download stopped by `netAbort(url)`.
4836 | Download stopped for an unknown reason, possibly a network error, or the download was abandoned.

When a movie plays back as an applet, this function always returns a string. The string either has a length of 0 or consists of text that describes an error. The string's content comes from Java and can vary on different operating systems or browsers. The text may not be translated into the local language.

When operating on an invalid URL, it is still conceivable for `netError()` to return OK. It is common for servers to return error pages when a requested file does not exist. These error pages usually have a mime-type of "text/html" and are therefore reported as successful transfers by `netError()`. To verify a successful operation, test for the expected mime-type with `netMime()` in addition to `netError()`.

Example

This statement passes a network ID to `netError` to check the error status of a particular network operation:

    on exitFrame
    	global mynetID
    	if netError(mynetID)<>"OK" then beep
    end