feat(proxy): add upstream error and rate-limit tracking support
This commit is contained in:
1 parent
c95f494569
commit
20fffff29c
6 files changed
+803
-2
No files matched your search
@@ -0,0 +1,23 @@
|
||||
export interface UpstreamErrorHeaders {
|
||||
retryAfter?: string;
|
||||
}
|
||||
|
||||
export class UpstreamRequestError extends Error {
|
||||
readonly status?: number;
|
||||
readonly headers?: UpstreamErrorHeaders;
|
||||
readonly body?: string;
|
||||
|
||||
constructor(params: {
|
||||
message: string;
|
||||
status?: number;
|
||||
headers?: UpstreamErrorHeaders;
|
||||
body?: string;
|
||||
}) {
|
||||
super(params.message);
|
||||
this.name = 'UpstreamRequestError';
|
||||
this.status = params.status;
|
||||
this.headers = params.headers;
|
||||
this.body = params.body;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user