Intercept HTTP errors in SignalR JavaScript Client
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
This is more of a question then a issue.
I'm using the @microsoft/signalr (v.6.0.0) javascript client in my Vue project.
This is my Connection Builder
`client = new HubConnectionBuilder()
.withUrl('/chat', { accessTokenFactory: () => IdService.getToken() })
.configureLogging(LogLevel.None)
.withAutomaticReconnect()
.build()`
Later when I start the connection:
`client.start().then(() => {
console.log('Connected')
}).catch((err) => {
console.error(err)
})`
What I would like to do is, if there is a error in the moment of starting the connection, I would like to know the HTTP status code from the catched error. Like this:
`client.start().then(() => {
console.log('Connected')
}).catch((err) => {
console.error(err.response.status)
})`
The problem is, the error that is getting catched is only a string. Of course I could filter the status code from the string but that seems wrong.
So my question is, is there any way or method to get the error codes?
Contributor guide
Assessment
This issue has not been assessed yet.