Skip to content

Commit

Permalink
Fix error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Sep 15, 2020
1 parent c76d92e commit 43ec834
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ description: >
# _struct: config_

{{% dir name="iopsecret" type="string" default="" %}}
The iopsecret used to connect to the wopiserver. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/grpc/services/appprovider/appprovider.go#L59)
The iopsecret used to connect to the wopiserver. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/grpc/services/appprovider/appprovider.go#L57)
{{< highlight toml >}}
[grpc.services.appprovider]
iopsecret = ""
{{< /highlight >}}
{{% /dir %}}

{{% dir name="wopiurl" type="string" default="" %}}
The wopiserver's URL. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/grpc/services/appprovider/appprovider.go#L60)
The wopiserver's URL. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/grpc/services/appprovider/appprovider.go#L58)
{{< highlight toml >}}
[grpc.services.appprovider]
wopiurl = ""
Expand Down
6 changes: 2 additions & 4 deletions internal/grpc/services/appprovider/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"path"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -134,7 +132,7 @@ func (s *service) getWopiAppEndpoints(ctx context.Context) (map[string]interface
}
defer appsRes.Body.Close()
if appsRes.StatusCode != http.StatusOK {
return nil, errors.New("Request to WOPI server returned " + string(appsRes.StatusCode))
return nil, fmt.Errorf("Request to WOPI server returned %d", appsRes.StatusCode)
}
appsBody, err := ioutil.ReadAll(appsRes.Body)
if err != nil {
Expand Down Expand Up @@ -201,7 +199,7 @@ func (s *service) OpenFileInAppProvider(ctx context.Context, req *providerpb.Ope

if openRes.StatusCode != http.StatusOK {
res := &providerpb.OpenFileInAppProviderResponse{
Status: status.NewInvalid(ctx, "appprovider: error performing open request to WOPI, status code: "+strconv.Itoa(openRes.StatusCode)),
Status: status.NewInvalid(ctx, fmt.Sprintf("appprovider: error performing open request to WOPI, status code: %d", openRes.StatusCode)),
}
return res, nil
}
Expand Down

0 comments on commit 43ec834

Please sign in to comment.