File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " lingo.dev " : patch
3+ " @lingo.dev/_sdk " : patch
4+ ---
5+
6+ handle errors from i18n when streaming
Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ async function retryWithExponentialBackoff<T>(
401401}
402402
403403function createLocalizationEngineConnection ( params : { apiKey : string ; apiUrl : string ; maxRetries ?: number } ) {
404- const replexicaEngine = new LingoDotDevEngine ( {
404+ const engine = new LingoDotDevEngine ( {
405405 apiKey : params . apiKey ,
406406 apiUrl : params . apiUrl ,
407407 } ) ;
@@ -423,7 +423,7 @@ function createLocalizationEngineConnection(params: { apiKey: string; apiUrl: st
423423 ) => {
424424 return retryWithExponentialBackoff (
425425 ( ) =>
426- replexicaEngine . localizeObject (
426+ engine . localizeObject (
427427 args . processableData ,
428428 {
429429 sourceLocale : args . sourceLocale ,
Original file line number Diff line number Diff line change @@ -129,6 +129,12 @@ export class LingoDotDevEngine {
129129 }
130130
131131 const jsonResponse = await res . json ( ) ;
132+
133+ // when streaming the error is returned in the response body
134+ if ( ! jsonResponse . data && jsonResponse . error ) {
135+ throw new Error ( jsonResponse . error ) ;
136+ }
137+
132138 return jsonResponse . data || { } ;
133139 }
134140
You can’t perform that action at this time.
0 commit comments