How to use the ice.Glacier2.CannotCreateSessionException 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
const username = $("#username").val() as string;
            const password = $("#password").val() as string;
            const session = await router.createSession(username, password);
            await run(router, ChatSessionPrx.uncheckedCast(session));
        }
        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
const router = await Glacier2.RouterPrx.checkedCast(communicator.getDefaultRouter());
        const username = $("#username").val() as string;
        const password = $("#password").val() as string;
        const session = await router.createSession(username, password);
        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)
        {
github zeroc-ice / ice-demos / typescript / nodejs / Glacier2 / simpleChat / Client.ts View on Github external
//
            console.log("This demo accepts any user-id / password combination.");
            process.stdout.write("user id: ");
            const id = await getline();
            process.stdout.write("password: ");
            const password = await getline();
            const session = await router.createSession(id, password);
            return Demo.ChatSessionPrx.uncheckedCast(session);
        }
        catch(ex)
        {
            if(ex instanceof Glacier2.PermissionDeniedException)
            {
                console.log("permission denied:\n" + ex.reason);
            }
            else if(ex instanceof Glacier2.CannotCreateSessionException)
            {
                console.log("cannot create session:\n" + ex.reason);
            }
            else
            {
                throw ex;
            }
        }
    }
github zeroc-ice / ice-demos / js / Glacier2 / simpleChat / Client.js View on Github external
//
            console.log("This demo accepts any user-id / password combination.");
            process.stdout.write("user id: ");
            const id = await getline();
            process.stdout.write("password: ");
            const password = await getline();
            const session = await router.createSession(id, password);
            return Demo.ChatSessionPrx.uncheckedCast(session);
        }
        catch(ex)
        {
            if(ex instanceof Glacier2.PermissionDeniedException)
            {
                console.log("permission denied:\n" + ex.reason);
            }
            else if(ex instanceof Glacier2.CannotCreateSessionException)
            {
                console.log("cannot create session:\n" + ex.reason);
            }
            else
            {
                throw ex;
            }
        }
    }