cmd/toot.go
changeset 45 b58a7ea1aeb2
parent 44 6da40ca4534c
child 70 155fdea254c3
equal deleted inserted replaced
44:6da40ca4534c 45:b58a7ea1aeb2
     4 // Please see the LICENSE file is this directory.
     4 // Please see the LICENSE file is this directory.
     5 
     5 
     6 package cmd
     6 package cmd
     7 
     7 
     8 import (
     8 import (
     9 	"errors"
     9 	"github.com/pkg/errors"
    10 
       
    11 	"github.com/spf13/cobra"
    10 	"github.com/spf13/cobra"
    12 
    11 
    13 	"github.com/McKael/madon"
    12 	"github.com/McKael/madon"
    14 )
    13 )
    15 
    14 
    74 			return nil, errors.New("too many media attachments")
    73 			return nil, errors.New("too many media attachments")
    75 		}
    74 		}
    76 
    75 
    77 		fileMediaID, err := uploadFile(opt.mediaFilePath)
    76 		fileMediaID, err := uploadFile(opt.mediaFilePath)
    78 		if err != nil {
    77 		if err != nil {
    79 			return nil, errors.New("cannot attach media file: " + err.Error())
    78 			return nil, errors.Wrap(err, "cannot attach media file")
    80 		}
    79 		}
    81 		if fileMediaID > 0 {
    80 		if fileMediaID > 0 {
    82 			ids = append(ids, fileMediaID)
    81 			ids = append(ids, fileMediaID)
    83 		}
    82 		}
    84 	}
    83 	}