Type Definitions
CallbackNotAFunction
Error throw when one passes a
newFn
parameter
that is not a function to any of the following events:
Properties:
Name | Type | Default | Description |
---|---|---|---|
name |
string
|
CallbackNotAFunction | Name of the error. |
message |
string
|
Message of the error. |
Type:
-
TypeError
Example
const connmanager = require("tcp-ip-connman");
const client = connmanager();
client.onRead("I am not a function!"); //error
ConnectHandlerNotAFunction
Error throw when one tries use setConnectFn
with a parameter that is not a function.
Properties:
Name | Type | Default | Description |
---|---|---|---|
name |
string
|
ConnectHandlerNotAFunction | Name of the error. |
message |
string
|
Message of the error. |
Type:
-
TypeError
Example
const connmanager = require("tcp-ip-connman");
const client = connmanager();
client.setConnectFn("I am not a function!"); //error
ConnectionDown
Error throw when one tries to use
send
and the socket used in the connection is destroyed,
meaning that there is no valid connection up.
Properties:
Name | Type | Default | Description |
---|---|---|---|
name |
string
|
ConnectionDown | Name of the error. |
message |
string
|
Message of the error. |
Type:
-
Error
Example
const connmanager = require("tcp-ip-connman");
const client = connmanager();
console.log(isConnected()); //false!
//error, there is no connection or the connection is down
client.send("I didn't connect b4!");
OptionsNotProvided
Error throw when one tries to use connect
without passing an options parameter.
Properties:
Name | Type | Default | Description |
---|---|---|---|
name |
string
|
OptionsNotProvided | Name of the error. |
message |
string
|
Message of the error. |
Type:
-
Error
Example
const connmanager = require("tcp-ip-connman");
const client = connmanager();
client.connect(); //error, a parameter is necessary