Skip to content

Commit f450747

Browse files
authored
Warning instead of error (#356)
Warning instead of error
1 parent b36f4cd commit f450747

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: manipulations/opengraphimg/opengraphimg.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package opengraphimg
1818

1919
import (
2020
"fmt"
21+
"log"
2122
"sort"
2223
"strings"
2324
"sync"
@@ -63,7 +64,8 @@ func Manipulator(runtime manipulations.Runtime, doc *html.Node) error {
6364

6465
img, err := getSuitableImg(runtime, c.Val)
6566
if err != nil {
66-
return err
67+
log.Printf("Warning: Unable to find suitable image for %q: %v", c.Val, err)
68+
continue
6769
}
6870

6971
if img == nil {

Diff for: manipulations/opengraphimg/opengraphimg_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ func TestManipulator(t *testing.T) {
5858
wantHTML: `<html><head><meta property="og:image"/></head><body></body></html>`,
5959
},
6060
{
61-
description: "return error if getting images fails",
61+
description: "do nothing if getting images fails",
6262
findNodes: htmlparsing.FindNodesByTag,
6363
doc: MustGetNode(t, `<meta property="og:image" content="/images/default-social.png" />`),
6464
genimgsLookupSizes: func(s3 *s3.Client, conf *config.Config, imgPath string) ([]genimgs.GenImg, error) {
6565
return nil, errInjected
6666
},
67-
wantError: errInjected,
67+
wantHTML: `<html><head><meta property="og:image" content="/images/default-social.png"/></head><body></body></html>`,
6868
},
6969
{
7070
description: "do nothing when no images",

0 commit comments

Comments
 (0)