mirror of
https://github.com/dstotijn/go-notion.git
synced 2025-12-05 22:57:43 +02:00
Fix error message when newRequest returns err
This commit is contained in:
@@ -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) {
|
func (c *Client) FindDatabaseByID(ctx context.Context, id string) (db Database, err error) {
|
||||||
req, err := c.newRequest(ctx, http.MethodGet, "/databases/"+id, nil)
|
req, err := c.newRequest(ctx, http.MethodGet, "/databases/"+id, nil)
|
||||||
if err != 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)
|
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)
|
req, err := c.newRequest(ctx, http.MethodPost, fmt.Sprintf("/databases/%v/query", id), body)
|
||||||
if err != nil {
|
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)
|
res, err := c.httpClient.Do(req)
|
||||||
|
|||||||
Reference in New Issue
Block a user