1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2024-11-24 08:42:26 +02:00

Fix error message when newRequest returns err

This commit is contained in:
David Stotijn 2021-05-15 00:20:11 +02:00
parent 807f08dace
commit 14a12ab965

View File

@ -67,7 +67,7 @@ func (c *Client) newRequest(ctx context.Context, method, url string, body io.Rea
func (c *Client) FindDatabaseByID(ctx context.Context, id string) (db Database, err error) {
req, err := c.newRequest(ctx, http.MethodGet, "/databases/"+id, nil)
if err != nil {
return Database{}, fmt.Errorf("notion: invalid URL: %w", err)
return Database{}, fmt.Errorf("notion: invalid request: %w", err)
}
res, err := c.httpClient.Do(req)
@ -100,7 +100,7 @@ func (c *Client) QueryDatabase(ctx context.Context, id string, query DatabaseQue
req, err := c.newRequest(ctx, http.MethodPost, fmt.Sprintf("/databases/%v/query", id), body)
if err != nil {
return DatabaseQueryResponse{}, fmt.Errorf("notion: invalid URL: %w", err)
return DatabaseQueryResponse{}, fmt.Errorf("notion: invalid request: %w", err)
}
res, err := c.httpClient.Do(req)