@mtcute/tl 167.0.0 → 167.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +19 -19
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -33,28 +33,28 @@ RpcError.fromTl = function (obj) {
33
33
  }
34
34
 
35
35
  var err = new RpcError(obj.errorCode, obj.errorMessage);
36
- var match;
37
- if ((match=err.text.match(/^FLOOD_WAIT_(\d+)$/))!=null){ err.text = 'FLOOD_WAIT_%d'; err.seconds = parseInt(match[1]) }
38
- else if ((match=err.text.match(/^FILE_MIGRATE_(\d+)$/))!=null){ err.text = 'FILE_MIGRATE_%d'; err.newDc = parseInt(match[1]) }
39
- else if ((match=err.text.match(/^NETWORK_MIGRATE_(\d+)$/))!=null){ err.text = 'NETWORK_MIGRATE_%d'; err.newDc = parseInt(match[1]) }
40
- else if ((match=err.text.match(/^PHONE_MIGRATE_(\d+)$/))!=null){ err.text = 'PHONE_MIGRATE_%d'; err.newDc = parseInt(match[1]) }
41
- else if ((match=err.text.match(/^STATS_MIGRATE_(\d+)$/))!=null){ err.text = 'STATS_MIGRATE_%d'; err.dc = parseInt(match[1]) }
42
- else if ((match=err.text.match(/^EMAIL_UNCONFIRMED_(\d+)$/))!=null){ err.text = 'EMAIL_UNCONFIRMED_%d'; err.codeLength = parseInt(match[1]) }
43
- else if ((match=err.text.match(/^PASSWORD_TOO_FRESH_(\d+)$/))!=null){ err.text = 'PASSWORD_TOO_FRESH_%d'; err.seconds = parseInt(match[1]) }
44
- else if ((match=err.text.match(/^SESSION_TOO_FRESH_(\d+)$/))!=null){ err.text = 'SESSION_TOO_FRESH_%d'; err.seconds = parseInt(match[1]) }
45
- else if ((match=err.text.match(/^PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_(\d+)MIN$/))!=null){ err.text = 'PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_%dMIN'; err.minutes = parseInt(match[1]) }
46
- else if ((match=err.text.match(/^2FA_CONFIRM_WAIT_(\d+)$/))!=null){ err.text = '2FA_CONFIRM_WAIT_%d'; err.seconds = parseInt(match[1]) }
47
- else if ((match=err.text.match(/^SLOWMODE_WAIT_(\d+)$/))!=null){ err.text = 'SLOWMODE_WAIT_%d'; err.seconds = parseInt(match[1]) }
48
- else if ((match=err.text.match(/^TAKEOUT_INIT_DELAY_(\d+)$/))!=null){ err.text = 'TAKEOUT_INIT_DELAY_%d'; err.seconds = parseInt(match[1]) }
49
- else if ((match=err.text.match(/^FILE_PART_(\d+)_MISSING$/))!=null){ err.text = 'FILE_PART_%d_MISSING'; err.which = parseInt(match[1]) }
50
- else if ((match=err.text.match(/^FLOOD_TEST_PHONE_WAIT_(\d+)$/))!=null){ err.text = 'FLOOD_TEST_PHONE_WAIT_%d'; err.seconds = parseInt(match[1]) }
51
- else if ((match=err.text.match(/^INTERDC_(\d+)_CALL_ERROR$/))!=null){ err.text = 'INTERDC_%d_CALL_ERROR'; err.dc = parseInt(match[1]) }
52
- else if ((match=err.text.match(/^INTERDC_(\d+)_CALL_RICH_ERROR$/))!=null){ err.text = 'INTERDC_%d_CALL_RICH_ERROR'; err.dc = parseInt(match[1]) }
53
- else if ((match=err.text.match(/^USER_MIGRATE_(\d+)$/))!=null){ err.text = 'USER_MIGRATE_%d'; err.newDc = parseInt(match[1]) }
36
+ var match, param;
37
+ if ((match=err.text.match(/^FLOOD_WAIT_(\d+)$/))!=null){ err.text = 'FLOOD_WAIT_%d'; param = err.seconds = parseInt(match[1]) }
38
+ else if ((match=err.text.match(/^FILE_MIGRATE_(\d+)$/))!=null){ err.text = 'FILE_MIGRATE_%d'; param = err.newDc = parseInt(match[1]) }
39
+ else if ((match=err.text.match(/^NETWORK_MIGRATE_(\d+)$/))!=null){ err.text = 'NETWORK_MIGRATE_%d'; param = err.newDc = parseInt(match[1]) }
40
+ else if ((match=err.text.match(/^PHONE_MIGRATE_(\d+)$/))!=null){ err.text = 'PHONE_MIGRATE_%d'; param = err.newDc = parseInt(match[1]) }
41
+ else if ((match=err.text.match(/^STATS_MIGRATE_(\d+)$/))!=null){ err.text = 'STATS_MIGRATE_%d'; param = err.dc = parseInt(match[1]) }
42
+ else if ((match=err.text.match(/^EMAIL_UNCONFIRMED_(\d+)$/))!=null){ err.text = 'EMAIL_UNCONFIRMED_%d'; param = err.codeLength = parseInt(match[1]) }
43
+ else if ((match=err.text.match(/^PASSWORD_TOO_FRESH_(\d+)$/))!=null){ err.text = 'PASSWORD_TOO_FRESH_%d'; param = err.seconds = parseInt(match[1]) }
44
+ else if ((match=err.text.match(/^SESSION_TOO_FRESH_(\d+)$/))!=null){ err.text = 'SESSION_TOO_FRESH_%d'; param = err.seconds = parseInt(match[1]) }
45
+ else if ((match=err.text.match(/^PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_(\d+)MIN$/))!=null){ err.text = 'PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_%dMIN'; param = err.minutes = parseInt(match[1]) }
46
+ else if ((match=err.text.match(/^2FA_CONFIRM_WAIT_(\d+)$/))!=null){ err.text = '2FA_CONFIRM_WAIT_%d'; param = err.seconds = parseInt(match[1]) }
47
+ else if ((match=err.text.match(/^SLOWMODE_WAIT_(\d+)$/))!=null){ err.text = 'SLOWMODE_WAIT_%d'; param = err.seconds = parseInt(match[1]) }
48
+ else if ((match=err.text.match(/^TAKEOUT_INIT_DELAY_(\d+)$/))!=null){ err.text = 'TAKEOUT_INIT_DELAY_%d'; param = err.seconds = parseInt(match[1]) }
49
+ else if ((match=err.text.match(/^FILE_PART_(\d+)_MISSING$/))!=null){ err.text = 'FILE_PART_%d_MISSING'; param = err.which = parseInt(match[1]) }
50
+ else if ((match=err.text.match(/^FLOOD_TEST_PHONE_WAIT_(\d+)$/))!=null){ err.text = 'FLOOD_TEST_PHONE_WAIT_%d'; param = err.seconds = parseInt(match[1]) }
51
+ else if ((match=err.text.match(/^INTERDC_(\d+)_CALL_ERROR$/))!=null){ err.text = 'INTERDC_%d_CALL_ERROR'; param = err.dc = parseInt(match[1]) }
52
+ else if ((match=err.text.match(/^INTERDC_(\d+)_CALL_RICH_ERROR$/))!=null){ err.text = 'INTERDC_%d_CALL_RICH_ERROR'; param = err.dc = parseInt(match[1]) }
53
+ else if ((match=err.text.match(/^USER_MIGRATE_(\d+)$/))!=null){ err.text = 'USER_MIGRATE_%d'; param = err.newDc = parseInt(match[1]) }
54
54
 
55
55
  else return err
56
56
 
57
- err.message = _descriptionsMap[err.text];
57
+ err.message = _descriptionsMap[err.text].replace('%d', param);
58
58
  return err
59
59
  }
60
60
  RpcError.create = function(code, text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtcute/tl",
3
- "version": "167.0.0",
3
+ "version": "167.0.1",
4
4
  "description": "TL schema used for mtcute",
5
5
  "main": "index.js",
6
6
  "author": "Alina Sireneva <alina@tei.su>",