Browse Source

Add more errors in QR login

Painor 3 years ago
parent
commit
c2dccb0463
1 changed files with 15 additions and 0 deletions
  1. 15 0
      gramjs/client/auth.ts

+ 15 - 0
gramjs/client/auth.ts

@@ -326,12 +326,27 @@ export async function signInUserWithQrCode(
                 migratedResult.authorization instanceof Api.auth.Authorization
             ) {
                 return migratedResult.authorization.user;
+            } else {
+                client._log.error(
+                    `Received unknown result while scanning QR ${result2.className}`
+                );
+                throw new Error(
+                    `Received unknown result while scanning QR ${result2.className}`
+                );
             }
+        } else {
+            client._log.error(
+                `Received unknown result while scanning QR ${result2.className}`
+            );
+            throw new Error(
+                `Received unknown result while scanning QR ${result2.className}`
+            );
         }
     } catch (err: any) {
         if (err.errorMessage === "SESSION_PASSWORD_NEEDED") {
             return client.signInWithPassword(apiCredentials, authParams);
         }
+        throw err;
     }
 
     await authParams.onError(new Error("QR auth failed"));