-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Fix a couple things in Typescript client #13863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,7 +322,7 @@ export class HttpConnection implements IConnection { | |
}); | ||
|
||
if (response.statusCode !== 200) { | ||
return Promise.reject(new Error(`Unexpected status code returned from negotiate ${response.statusCode}`)); | ||
return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`)); | ||
} | ||
|
||
const negotiateResponse = JSON.parse(response.content as string) as INegotiateResponse; | ||
|
@@ -475,8 +475,8 @@ export class HttpConnection implements IConnection { | |
} | ||
|
||
if (this.connectionState === ConnectionState.Connecting) { | ||
this.logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection hasn't yet left the in the connecting state.`); | ||
return; | ||
this.logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is still in the connecting state.`); | ||
throw new Error(`HttpConnection.stopConnection(${error}) was called while the connection is still in the connecting state.`); | ||
} | ||
|
||
if (this.connectionState === ConnectionState.Disconnecting) { | ||
|
@@ -626,7 +626,7 @@ export class TransportSendQueue { | |
offset += item.byteLength; | ||
} | ||
|
||
return result; | ||
return result.buffer; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? who uses this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting that the type checker didn't catch this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ArrayBuffer is a weird type. It has basically no public members, you have to wrap it in a view like Short answer: Type checker be weird |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better throw rather than no-op and log a warning if stopConnection is called while the connection is in the connecting state. HubConnection should await any start tasks in stop() and protect us from this actually occurring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you wanting me to change that behavior in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not too risky, yes. I don't want to have to spin a new PR for some code cleanup. If it causes a bunch of tests to fail, or you feel it's risky, we can make it another PR.