File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ export class Client extends EventEmitter {
7979 * @see end
8080 */
8181
82- public connected : boolean ;
82+ readonly connected : boolean ;
8383
8484 constructor ( dbUrl : string , options ?: ClientOptions ) {
8585 super ( ) ;
@@ -97,6 +97,8 @@ export class Client extends EventEmitter {
9797 */
9898
9999 public async connect ( ) : Promise < Client > {
100+ if ( this . connected ) throw new Error ( "Client has already been connected." ) ;
101+
100102 await this . client . connect ( ) ;
101103 this . connected = true ;
102104
@@ -117,6 +119,8 @@ export class Client extends EventEmitter {
117119 */
118120
119121 public async end ( ) : Promise < Client > {
122+ if ( ! this . connected ) throw new Error ( "Client has not been connected yet." ) ;
123+
120124 await this . client . end ( ) ;
121125 this . connected = false ;
122126
You can’t perform that action at this time.
0 commit comments