generaltranslation 2.0.62 → 2.0.64

Sign up to get free protection for your applications and to get access to all the features.
@@ -83,11 +83,9 @@ function _translateBundle(gt, requests) {
83
83
  case 6:
84
84
  error_1 = _g.sent();
85
85
  if (error_1 instanceof Error && error_1.name === 'AbortError') {
86
- console.error('Request timed out');
87
- return [2 /*return*/, Array.from(requests, function () { return ({ translation: null, error: 'Request timed out' }); })];
86
+ throw new Error('Error: Request timed out.');
88
87
  }
89
- console.error(error_1);
90
- return [2 /*return*/, Array.from(requests, function () { return ({ translation: null, error: error_1 }); })];
88
+ throw new Error("".concat(error_1));
91
89
  case 7: return [2 /*return*/];
92
90
  }
93
91
  });
@@ -74,11 +74,9 @@ function _updateProjectDictionary(gt, updates, languages, projectID, replace) {
74
74
  case 5:
75
75
  error_1 = _d.sent();
76
76
  if (error_1 instanceof Error && error_1.name === 'AbortError') {
77
- console.error('Request timed out');
78
- return [2 /*return*/, []];
77
+ throw new Error('Error: Request timed out.');
79
78
  }
80
- console.error(error_1);
81
- return [2 /*return*/, []];
79
+ throw new Error("".concat(error_1));
82
80
  case 6: return [2 /*return*/];
83
81
  }
84
82
  });
@@ -71,7 +71,7 @@ function _translateReact(gt, content, targetLanguage, metadata) {
71
71
  'gtx-api-key': gt.apiKey,
72
72
  },
73
73
  body: JSON.stringify({
74
- content: content,
74
+ children: content,
75
75
  targetLanguage: targetLanguage,
76
76
  metadata: metadata
77
77
  }),
@@ -89,17 +89,9 @@ function _translateReact(gt, content, targetLanguage, metadata) {
89
89
  case 6:
90
90
  error_1 = _d.sent();
91
91
  if (error_1 instanceof Error && error_1.name === 'AbortError') {
92
- console.error('Request timed out');
93
- return [2 /*return*/, {
94
- translation: null,
95
- error: 'Request timed out'
96
- }];
92
+ throw new Error('Error: Request timed out.');
97
93
  }
98
- console.error(error_1);
99
- return [2 /*return*/, {
100
- translation: null,
101
- error: error_1
102
- }];
94
+ throw new Error("".concat(error_1));
103
95
  case 7: return [2 /*return*/];
104
96
  }
105
97
  });
@@ -91,17 +91,9 @@ function _translate(gt, content, targetLanguage, metadata) {
91
91
  case 6:
92
92
  error_1 = _d.sent();
93
93
  if (error_1 instanceof Error && error_1.name === 'AbortError') {
94
- console.error('Request timed out');
95
- return [2 /*return*/, {
96
- translation: content,
97
- error: 'Request timed out'
98
- }];
94
+ throw new Error('Error: Request timed out.');
99
95
  }
100
- console.error(error_1);
101
- return [2 /*return*/, {
102
- translation: content,
103
- error: error_1
104
- }];
96
+ throw new Error("".concat(error_1));
105
97
  case 7: return [2 /*return*/];
106
98
  }
107
99
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generaltranslation",
3
- "version": "2.0.62",
3
+ "version": "2.0.64",
4
4
  "description": "A language toolkit for AI developers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",