Skip to content

Commit

Permalink
Fix parsing of Retry-After
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny-signal authored Jan 17, 2024
1 parent 6dfef6e commit fa3937e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ts/jobs/helpers/findRetryAfterTimeFromError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ export function findRetryAfterTimeFromError(err: unknown): number {
}
}

if (Array.isArray(rawValue)) {
return parseRetryAfterWithDefault(rawValue[0]);
}

return parseRetryAfterWithDefault(rawValue);
}
8 changes: 2 additions & 6 deletions ts/textsecure/Errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,20 @@ function appendStack(newError: Error, originalError: Error) {
newError.stack += `\nOriginal stack:\n${originalError.stack}`;
}

export type HTTPErrorHeadersType = {
[name: string]: string | ReadonlyArray<string>;
};

export class HTTPError extends Error {
public override readonly name = 'HTTPError';

public readonly code: number;

public readonly responseHeaders: HTTPErrorHeadersType;
public readonly responseHeaders: HeaderListType;

public readonly response: unknown;

constructor(
message: string,
options: {
code: number;
headers: HTTPErrorHeadersType;
headers: HeaderListType;
response?: unknown;
stack?: string;
cause?: unknown;
Expand Down

0 comments on commit fa3937e

Please sign in to comment.