Skip to content

Commit

Permalink
use errors.As
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld committed Oct 16, 2024
1 parent b6eb56a commit 8fe6899
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion integrationtests/api_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package integrationtests
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -32,7 +33,8 @@ func (a *apiHelper) logResult(desc string, err error) error {
return nil
}
addInfo := ""
if gse, ok := err.(*ldapi.GenericOpenAPIError); ok {
var gse *ldapi.GenericOpenAPIError
if errors.As(err, &gse) {
body := string(gse.Body())
addInfo = " - " + string(body)
}
Expand Down

0 comments on commit 8fe6899

Please sign in to comment.