Skip to content

Commit c4cabf6

Browse files
committed
Put more Socket API in error messages
1 parent d92830b commit c4cabf6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ const DEFAULT_USER_AGENT = createUserAgentFromPkgJson(rootPkgJson)
5757

5858
class ResponseError extends Error {
5959
response: IncomingMessage
60-
constructor(response: IncomingMessage, message: string) {
61-
super(`${message}: ${response.statusCode} - ${response.statusMessage}`)
60+
constructor(response: IncomingMessage, message: string = '') {
61+
super(
62+
`Socket API ${message || 'request failed'}: ${response.statusCode} - ${response.statusMessage}`
63+
)
6264
this.response = response
6365
}
6466
}

0 commit comments

Comments
 (0)