1.0.4 • Published 1 year ago

@acsl/error v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

ACSL error module

Introduction

(1) Timeout

Tinio

The TinioSession.request method could throw this error out when the peer not respond the request in Tinio.requestTimeout seconds. in this case, the desc and origin fields should be ignored, and the data field contains the following data:

data = {
    peer: string,           // The url or address of the peer
    ses?: TinioSession,     // The session object which throw the error
    msg?: string,           // The msg argument for the request method
                            // and undefined for the acquireSession 
    data: any               // The data argument for the request and
                            // undefine the the acquireSession
}

(3) AppError

Application error, the desc and data fields were ignored; the origin contain the origin Error object.

(4) Canceled

The operation was canceled by the application.

(5) InvalidData

Tinio

When the application receives this error via Tinio.delegate.onError callback, it stands for an invalid package has been received from the peer of a session.

If the Error was throw out by the send and request methods of a TinioSession object, It stands for the stringificating of the source packet was failed.

The desc field of this error contains a short description of this error, the data field contains the following object, and the origin field should be ignored.

    data = {
        peer: string,               // peer url or address
        ses?: TinioSession,         // Tinio session object
        msg: any                    // Data content
    }

(1000) TinioWebSocketError

    desc = Ignored
    data = {
        peer: string,               // peer url or address
        ses?: TinioSession,         // Tinio session object
        err: WebSocket.ErrorEvent   // Origin error data
    }
    origin = Ignored

(1001) TinioReset

    data = {
        peer: string,
        ses?: TinioSession,
        event?: WebSocket.CloseEvent
    }

(1002) TinioReject

    data = {
        peer: string,
        data: any       // Ack data
    }