websocket: handle error (#550)

Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
Heitor 2023-08-16 22:48:57 -03:00 committed by GitHub
parent 67941865db
commit 7d570ce148
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -1546,7 +1546,7 @@ endpoints:
```
The `[BODY]` placeholder contains the output of the query, and `[CONNECTED]`
shows whether the connected was successfully established.
shows whether the connection was successfully established.
### Monitoring an endpoint using ICMP
By prefixing `endpoints[].url` with `icmp:\\`, you can monitor endpoints at a very basic level using ICMP, or more

View File

@ -346,6 +346,10 @@ func (endpoint *Endpoint) call(result *Result) {
} else if endpointType == EndpointTypeWS {
result.Connected, result.Body, err = client.QueryWebSocket(endpoint.URL, endpoint.ClientConfig, endpoint.Body)
result.Duration = time.Since(startTime)
if err != nil {
result.AddError(err.Error())
return
}
} else {
response, err = client.GetHTTPClient(endpoint.ClientConfig).Do(request)
result.Duration = time.Since(startTime)