handle or ignore error

This commit is contained in:
Celogeek 2024-03-03 12:09:04 +01:00
parent 40a79e8e6b
commit efc5a9793e
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc
11 changed files with 34 additions and 15 deletions

View File

@ -7,5 +7,8 @@ type CategoriesGroup struct {
var categoriesGroup CategoriesGroup var categoriesGroup CategoriesGroup
func init() { func init() {
parser.AddCommand("categories", "Categories management", "", &categoriesGroup) _, err := parser.AddCommand("categories", "Categories management", "", &categoriesGroup)
if err != nil {
panic(err)
}
} }

View File

@ -55,5 +55,8 @@ func (c *GetInfosCommand) Execute(args []string) error {
} }
func init() { func init() {
parser.AddCommand("getinfos", "Get general information", "", &getInfosCommand) _, err := parser.AddCommand("getinfos", "Get general information", "", &getInfosCommand)
if err != nil {
panic(err)
}
} }

View File

@ -11,5 +11,8 @@ type ImagesGroup struct {
var imagesGroup ImagesGroup var imagesGroup ImagesGroup
func init() { func init() {
parser.AddCommand("images", "Images management", "", &imagesGroup) _, err := parser.AddCommand("images", "Images management", "", &imagesGroup)
if err != nil {
panic(err)
}
} }

View File

@ -64,7 +64,7 @@ func (c *ImagesListCommand) Execute(args []string) error {
bar := progressbar.Default(1, "listing") bar := progressbar.Default(1, "listing")
progressbar.OptionOnCompletion(func() { progressbar.OptionOnCompletion(func() {
os.Stderr.WriteString("\n") _, _ = os.Stderr.WriteString("\n")
})(bar) })(bar)
for page := 0; ; page++ { for page := 0; ; page++ {
var resp ImagesListResult var resp ImagesListResult
@ -95,14 +95,14 @@ func (c *ImagesListCommand) Execute(args []string) error {
} }
rootTree.AddPath(filename) rootTree.AddPath(filename)
} }
bar.Add(1) _ = bar.Add(1)
} }
if resp.Paging.Count < resp.Paging.PerPage { if resp.Paging.Count < resp.Paging.PerPage {
break break
} }
} }
bar.Close() _ = bar.Close()
var results chan string var results chan string
if c.Tree { if c.Tree {

View File

@ -134,7 +134,7 @@ func (c *ImagesTagCommand) Execute(args []string) error {
if len(sel) == 0 { if len(sel) == 0 {
exit := false exit := false
survey.AskOne(&survey.Confirm{ _ = survey.AskOne(&survey.Confirm{
Message: "Selection is empty, exit:", Message: "Selection is empty, exit:",
Default: false, Default: false,
}, &exit) }, &exit)
@ -144,7 +144,7 @@ func (c *ImagesTagCommand) Execute(args []string) error {
} }
confirmSel := false confirmSel := false
survey.AskOne(&survey.Confirm{ _ = survey.AskOne(&survey.Confirm{
Message: "Confirm:", Message: "Confirm:",
Default: true, Default: true,
}, &confirmSel) }, &confirmSel)

View File

@ -9,5 +9,8 @@ type MethodGroup struct {
var methodGroup MethodGroup var methodGroup MethodGroup
func init() { func init() {
parser.AddCommand("method", "Reflexion management", "", &methodGroup) _, err := parser.AddCommand("method", "Reflexion management", "", &methodGroup)
if err != nil {
panic(err)
}
} }

View File

@ -8,5 +8,8 @@ type SessionGroup struct {
var sessionGroup SessionGroup var sessionGroup SessionGroup
func init() { func init() {
parser.AddCommand("session", "Session management", "", &sessionGroup) _, err := parser.AddCommand("session", "Session management", "", &sessionGroup)
if err != nil {
panic(err)
}
} }

View File

@ -106,7 +106,9 @@ func (p *Piwigo) Upload(file *piwigotools.FileToUpload, stat *piwigotools.FileTo
if hasVideoJS { if hasVideoJS {
switch *file.Ext() { switch *file.Ext() {
case "ogg", "ogv", "mp4", "m4v", "webm", "webmv": case "ogg", "ogv", "mp4", "m4v", "webm", "webmv":
p.VideoJSSync(resp.ImageId) if err := p.VideoJSSync(resp.ImageId); err != nil {
stat.Error("VideoJSSync", *file.FullPath(), err)
}
} }
} }

View File

@ -28,7 +28,9 @@ func (p *Piwigo) GetStatus() (*StatusResponse, error) {
return nil, err return nil, err
} }
p.Post("pwg.plugins.getList", nil, &resp.Plugins) if err := p.Post("pwg.plugins.getList", nil, &resp.Plugins); err != nil {
return nil, err
}
if resp.User == p.Username { if resp.User == p.Username {
return resp, nil return resp, nil

View File

@ -178,9 +178,9 @@ func (f *FileToUpload) Base64BuildChunk() (chan *FileToUploadChunk, error) {
break break
} }
bf.Size += int64(n) bf.Size += int64(n)
b64.Write(b[:n]) _, _ = b64.Write(b[:n])
} }
b64.Close() _ = b64.Close()
if bf.Size > 0 { if bf.Size > 0 {
out <- bf out <- bf
} }

View File

@ -67,7 +67,7 @@ func (t Tags) Selector(exclude *regexp.Regexp, keepFilter bool, keepPreviousAnsw
return func() Tags { return func() Tags {
answer := []string{} answer := []string{}
survey.AskOne(&survey.MultiSelect{ _ = survey.AskOne(&survey.MultiSelect{
Message: "Tags:", Message: "Tags:",
Options: options, Options: options,
PageSize: 20, PageSize: 20,