Skip to content

Commit

Permalink
fix: rethrow exceptions other than InvalidBucketNameError (#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
iyxan23 authored Sep 5, 2024
1 parent 147072e commit e556d26
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/internal/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2886,7 +2886,11 @@ export class TypedClient {
expires,
)
} catch (err) {
throw new errors.InvalidArgumentError(`Unable to get bucket region for ${bucketName}.`)
if (err instanceof errors.InvalidBucketNameError) {
throw new errors.InvalidArgumentError(`Unable to get bucket region for ${bucketName}.`)
}

throw err
}
}

Expand Down Expand Up @@ -2987,8 +2991,12 @@ export class TypedClient {
const portStr = this.port == 80 || this.port === 443 ? '' : `:${this.port.toString()}`
const urlStr = `${reqOptions.protocol}//${reqOptions.host}${portStr}${reqOptions.path}`
return { postURL: urlStr, formData: postPolicy.formData }
} catch (er) {
throw new errors.InvalidArgumentError(`Unable to get bucket region for ${bucketName}.`)
} catch (err) {
if (err instanceof errors.InvalidBucketNameError) {
throw new errors.InvalidArgumentError(`Unable to get bucket region for ${bucketName}.`)
}

throw err
}
}
}

0 comments on commit e556d26

Please sign in to comment.