vaticle / typedb-console

TypeDB Console: CLI for TypeDB and TypeDB Cluster
https://typedb.com
Mozilla Public License 2.0
7 stars 16 forks source link

"Missing credential" error is not user-friendly (connecting to TypeDB Cluster without correct args) #194

Open alexjpwalker opened 1 year ago

alexjpwalker commented 1 year ago

Problem to Solve

When you use ./typedb console in Cluster, it says:

[CLS06] Server Error: Missing credential.

Proposed Solution

Although it's fairly clear what the problem is, the message could definitely be nicer. For instance, it could say that the CLI arguments --username and --password are required.

lolski commented 11 months ago

To be specific, there are two other things that makes it even worse.

One, the stack trace is printed even though there's no need to:

./typedb console --cluster=typedb-cluster-1:1729 --username=admin --password
Password: <an-incorrect-password>

Welcome to TypeDB Console. You are now in TypeDB Wonderland!
Copyright (C) 2022 Vaticle

Exception in thread "main" io.grpc.StatusRuntimeException: UNAUTHENTICATED: [CLS07] Server Error: Invalid password credential.
    at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
    at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
    at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
    at com.vaticle.typedb.protocol.TypeDBClusterGrpc$TypeDBClusterBlockingStub.userToken(TypeDBClusterGrpc.java:775)
    at com.vaticle.typedb.client.connection.cluster.ClusterServerStub.<init>(ClusterServerStub.java:66)
    at com.vaticle.typedb.client.connection.cluster.ClusterServerClient.<init>(ClusterServerClient.java:53)
    at com.vaticle.typedb.client.connection.cluster.ClusterClient.fetchCurrentAddresses(ClusterClient.java:79)
    at com.vaticle.typedb.client.connection.cluster.ClusterClient.<init>(ClusterClient.java:69)
    at com.vaticle.typedb.client.connection.cluster.ClusterClient.<init>(ClusterClient.java:63)
    at com.vaticle.typedb.client.TypeDB.clusterClient(TypeDB.java:54)
    at com.vaticle.typedb.console.TypeDBConsole.createTypeDBClient(TypeDBConsole.java:466)
    at com.vaticle.typedb.console.TypeDBConsole.runREPLMode(TypeDBConsole.java:177)
    at com.vaticle.typedb.console.TypeDBConsole.main(TypeDBConsole.java:128)

And two, Console will actually hang rather than terminating with error.