fixes some lint errors
This commit is contained in:
parent
5ccf4e6168
commit
12c12e53f7
16 changed files with 108 additions and 93 deletions
|
@ -107,9 +107,11 @@ func StoreMedias(
|
|||
medias []*models.DownloadedMedia,
|
||||
) error {
|
||||
var storedMedias []*models.Media
|
||||
|
||||
if len(medias) == 0 {
|
||||
return fmt.Errorf("no media to store")
|
||||
}
|
||||
|
||||
for idx, msg := range msgs {
|
||||
fileID := GetMessageFileID(&msg)
|
||||
if len(fileID) == 0 {
|
||||
|
@ -211,27 +213,22 @@ func HandleErrorMessage(
|
|||
for currentError != nil {
|
||||
var botError *util.Error
|
||||
if errors.As(currentError, &botError) {
|
||||
SendErrorMessage(bot, ctx, fmt.Sprintf(
|
||||
"error occurred when downloading: %s",
|
||||
currentError.Error(),
|
||||
))
|
||||
SendErrorMessage(bot, ctx,
|
||||
"error occurred when downloading: "+currentError.Error(),
|
||||
)
|
||||
return
|
||||
}
|
||||
currentError = errors.Unwrap(currentError)
|
||||
}
|
||||
|
||||
lastError := util.GetLastError(err)
|
||||
errorMessage := fmt.Sprintf(
|
||||
"error occurred when downloading: %s",
|
||||
lastError.Error(),
|
||||
)
|
||||
errorMessage := "error occurred when downloading: " + lastError.Error()
|
||||
|
||||
if strings.Contains(errorMessage, bot.Token) {
|
||||
errorMessage = "telegram related error, probably connection issue"
|
||||
}
|
||||
|
||||
SendErrorMessage(bot, ctx, errorMessage)
|
||||
|
||||
}
|
||||
|
||||
func SendErrorMessage(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue