Skip to content

Commit 6cdc16d

Browse files
committed
address comment
1 parent 7b7d30c commit 6cdc16d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

eval_protocol/quickstart/svg_agent/vercel_svg_server_ts/src/models/exceptions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ export class UnauthenticatedError extends EvalProtocolError {
116116
}
117117
}
118118

119+
type EvalProtocolErrorConstructor = new (message?: string) => EvalProtocolError;
120+
119121
// Mapping from status codes to exception classes
120-
const STATUS_CODE_TO_EXCEPTION = new Map<StatusCode, typeof EvalProtocolError | null>([
122+
const STATUS_CODE_TO_EXCEPTION = new Map<StatusCode, EvalProtocolErrorConstructor | null>([
121123
[StatusCode.OK, null],
122124
[StatusCode.CANCELLED, CancelledError],
123125
[StatusCode.UNKNOWN, UnknownError],
@@ -148,7 +150,7 @@ export function exceptionForStatusCode(code: StatusCode, message: string = ''):
148150
if (!exceptionClass) {
149151
return null;
150152
}
151-
return new exceptionClass(message, code);
153+
return new exceptionClass(message);
152154
}
153155

154156
/**

typescript/models/exceptions.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ export class DataLossError extends EvalProtocolError {
103103

104104
export class UnauthenticatedError extends EvalProtocolError {
105105
constructor(message: string = '') {
106-
super(message, StatusCode.UNAUTHENTICATED);
106+
super(message, StatusCode.UNAUTHENTICATED);
107107
}
108108
}
109109

110-
const STATUS_CODE_TO_EXCEPTION = new Map<StatusCode, typeof EvalProtocolError | null>([
110+
type EvalProtocolErrorConstructor = new (message?: string) => EvalProtocolError;
111+
112+
const STATUS_CODE_TO_EXCEPTION = new Map<StatusCode, EvalProtocolErrorConstructor | null>([
111113
[StatusCode.OK, null],
112114
[StatusCode.CANCELLED, CancelledError],
113115
[StatusCode.UNKNOWN, UnknownError],
@@ -135,7 +137,7 @@ export function exceptionForStatusCode(code: StatusCode, message: string = ''):
135137
if (!exceptionClass) {
136138
return null;
137139
}
138-
return new exceptionClass(message, code);
140+
return new exceptionClass(message);
139141
}
140142

141143
export function mapOpenAIErrorToStatus(error: any): Status {

typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
},
1212
"files": ["dist"],
13-
"version": "0.1.7",
13+
"version": "0.1.8",
1414
"devDependencies": {
1515
"@types/bun": "latest"
1616
},

0 commit comments

Comments
 (0)