test(e2e): gracefully handle PHONE_NUMBER_FLOOD
This commit is contained in:
parent
710ef3f211
commit
c25f80b603
2 changed files with 8 additions and 4 deletions
|
@ -31,7 +31,8 @@ Deno.test('1. authorization', { sanitizeResources: false }, async (t) => {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
|
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
|
||||||
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED')
|
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED') ||
|
||||||
|
tl.RpcError.is(e, 'PHONE_NUMBER_FLOOD')
|
||||||
) {
|
) {
|
||||||
// retry with another number
|
// retry with another number
|
||||||
await tg.logOut().catch((err) => {
|
await tg.logOut().catch((err) => {
|
||||||
|
@ -72,7 +73,8 @@ Deno.test('1. authorization', { sanitizeResources: false }, async (t) => {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
|
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
|
||||||
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED')
|
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED') ||
|
||||||
|
tl.RpcError.is(e, 'PHONE_NUMBER_FLOOD')
|
||||||
) {
|
) {
|
||||||
// retry with another number
|
// retry with another number
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -34,7 +34,8 @@ describe('1. authorization', function () {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
|
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
|
||||||
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED')
|
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED') ||
|
||||||
|
tl.RpcError.is(e, 'PHONE_NUMBER_FLOOD')
|
||||||
) {
|
) {
|
||||||
// retry with another number
|
// retry with another number
|
||||||
await tg.logOut().catch((err) => {
|
await tg.logOut().catch((err) => {
|
||||||
|
@ -75,7 +76,8 @@ describe('1. authorization', function () {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
|
(e instanceof MtcuteError && e.message.match(/Signup is no longer supported|2FA is enabled/)) ||
|
||||||
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED')
|
tl.RpcError.is(e, 'SESSION_PASSWORD_NEEDED') ||
|
||||||
|
tl.RpcError.is(e, 'PHONE_NUMBER_FLOOD')
|
||||||
) {
|
) {
|
||||||
// retry with another number
|
// retry with another number
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue