How to use the ice.Ice.ConnectFailedException function in ice

To help you get started, we’ve selected a few ice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeroc-ice / ice-demos / typescript / browser / Chat / Client.ts View on Github external
}
        catch(ex)
        {
            console.log(ex.toString());
            //
            // Handle any exceptions that occurred during session creation.
            //
            if(ex instanceof Glacier2.PermissionDeniedException)
            {
                await setState(State.Disconnected, "permission denied:\n" + ex.reason);
            }
            else if(ex instanceof Glacier2.CannotCreateSessionException)
            {
                await setState(State.Disconnected, "cannot create session:\n" + ex.reason);
            }
            else if(ex instanceof Ice.ConnectFailedException)
            {
                await setState(State.Disconnected, "connection to server failed");
            }
            else
            {
                await setState(State.Disconnected, ex.toString());
            }
        }
    }
github zeroc-ice / ice-demos / typescript / browser / Glacier2 / simpleChat / Client.ts View on Github external
await runWithSession(router, Demo.ChatSessionPrx.uncheckedCast(session));
    }
    catch(ex)
    {
        //
        // Handle any exceptions that occurred during session creation.
        //
        if(ex instanceof Glacier2.PermissionDeniedException)
        {
            await error("permission denied:\n" + ex.reason);
        }
        else if(ex instanceof Glacier2.CannotCreateSessionException)
        {
            await error("cannot create session:\n" + ex.reason);
        }
        else if(ex instanceof Ice.ConnectFailedException)
        {
            await error("connection to server failed");
        }
        else
        {
            await error(ex.toString());
        }
    }
    finally
    {
        if(communicator)
        {
            await communicator.destroy();
        }
    }
}