@@ -129,7 +129,7 @@ function spokenTermsEntriesToJson(entries: SpokenTermsEntries): Record<string, u
129129}
130130
131131/**
132- * Throws a plain DeepLError for a failed response from a pre-signed storage URL. These are not
132+ * Throws a plain DeepLError for a failed upload to a pre-signed storage URL. These are not
133133 * DeepL API responses, so the API's status code mapping (e.g. 403 to AuthorizationError) does
134134 * not apply.
135135 */
@@ -1539,8 +1539,8 @@ export class DeepLClient extends Translator {
15391539 * @param outputFile: String containing output file path, or a WriteStream to store file data.
15401540 *
15411541 * @throws {DeepLError } If the job has no download URL, or any error occurs while downloading.
1542- * An error response from the download URL is a plain DeepLError carrying httpStatusCode,
1543- * never one of its subclasses .
1542+ * An error response from the download URL is mapped like a document download response
1543+ * (e.g. 403 to AuthorizationError, 503 to DocumentNotReadyError), with httpStatusCode set .
15441544 */
15451545 async downloadTranslationMemoryExport (
15461546 job : Omit < TranslationMemoryJob , 'done' | 'ok' | 'creationTime' | 'updatedTime' > ,
@@ -1574,13 +1574,9 @@ export class DeepLClient extends Translator {
15741574 { } ,
15751575 true ,
15761576 ) ;
1577- if ( statusCode < 200 || statusCode >= 300 ) {
1578- await throwStorageError (
1579- 'Error downloading translation memory export' ,
1580- statusCode ,
1581- content ,
1582- ) ;
1583- }
1577+ // The released status code mapping (e.g. 403 to AuthorizationError, 503 to
1578+ // DocumentNotReadyError) is kept until the next major version.
1579+ await checkStatusCode ( statusCode , content , false , true ) ;
15841580
15851581 if ( fd === undefined ) {
15861582 return await pipeToStream ( content , outputFile as fs . WriteStream ) ;
0 commit comments