Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Assignment 1
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aksel Baardsen
Assignment 1
Commits
31494a7b
Commit
31494a7b
authored
5 years ago
by
Aksel Baardsen
Browse files
Options
Downloads
Patches
Plain Diff
now checks for timeout using net.Error
parent
137637d4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/diag.go
+3
-3
3 additions, 3 deletions
pkg/diag.go
with
3 additions
and
3 deletions
pkg/diag.go
+
3
−
3
View file @
31494a7b
package
pkg
import
(
"net"
"strconv"
"strings"
"time"
)
...
...
@@ -29,7 +29,7 @@ func GetDiag(d* Diag) error {
// gets status of GBIF api, returns appropriate error
if
err
:=
getGbifStatus
(
d
);
err
!=
nil
{
// if it was a timeout caused by the http.client there was no returned status code of API
if
strings
.
Contains
(
err
.
Error
(),
"error occurred while contacting"
)
{
if
err
,
ok
:=
err
.
(
net
.
Error
);
ok
&&
err
.
Timeout
(
)
{
d
.
Gbif
=
"The server did not give a timely response: No status code returned"
}
else
{
return
err
...
...
@@ -39,7 +39,7 @@ func GetDiag(d* Diag) error {
// gets status of restcountries api, returns appropriate error
if
err
:=
getRestStatus
(
d
);
err
!=
nil
{
// if it was a timeout caused by the http.client there was no returned status code of API
if
strings
.
Contains
(
err
.
Error
(),
"error occurred while contacting"
)
{
if
err
,
ok
:=
err
.
(
net
.
Error
);
ok
&&
err
.
Timeout
(
)
{
d
.
Gbif
=
"The server did not give a timely response: No status code returned"
}
else
{
return
err
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment