Skip to content

Commit

Permalink
fix: type
Browse files Browse the repository at this point in the history
  • Loading branch information
gxkl committed Oct 21, 2024
1 parent 7142916 commit ab0d6c3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/OSSBaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export abstract class OSSBaseClient {

// https://help.aliyun.com/zh/oss/support/http-status-code-409#section-rmc-hvd-j38
if (info?.Code === 'PositionNotEqualToLength' && result.headers['x-oss-next-append-position']) {
(err as any).nextAppendPosition = result.headers['x-oss-next-append-position'];
err.nextAppendPosition = result.headers['x-oss-next-append-position'] as string;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/error/OSSClientError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class OSSClientError extends Error {
status: number;
requestId?: string;
hostId?: string;
nextAppendPosition?: string;

constructor(status: number, code: string, message: string, requestId?: string, hostId?: string) {
super(`[${REQUEST_ID_KEY}=${requestId}, ${RESPONSE_CODE_KEY}=${code}, ${RESPONSE_HOST_KEY}=${hostId}] ${message}`);
Expand Down
2 changes: 1 addition & 1 deletion test/OSSObject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ describe('test/OSSObject.test.ts', () => {
assert.equal(err.name, 'OSSClientError');
assert.equal(err.code, 'PositionNotEqualToLength');
assert.equal(err.status, 409);
assert.equal((err as any).nextAppendPosition, '3');
assert.equal(err.nextAppendPosition, '3');
assert.match(err.message, /Position is not equal to file length/);
return true;
});
Expand Down

0 comments on commit ab0d6c3

Please sign in to comment.