Skip to content

Commit

Permalink
log post response
Browse files Browse the repository at this point in the history
  • Loading branch information
jasondborneman committed Dec 20, 2023
1 parent 6c09615 commit bb1e777
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Bsky/Bsky.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -132,7 +133,13 @@ func PostWithMedia(message string, media [][]byte) error {
return postErr
}
if postResp.StatusCode != 200 {
message := fmt.Sprintf("Non-200 Status Code Returned making post: %d [%s]", postResp.StatusCode, url)
b, err := io.ReadAll(postResp.Body)
if err != nil {
log.Fatalf("Error reading Bsky Media Post response: %s", err)
return err
}

message := fmt.Sprintf("Non-200 Status Code Returned making post: %d [%s] [%s]", postResp.StatusCode, url, string(b))
log.Fatal(message)
return errors.New(message)
}
Expand Down

0 comments on commit bb1e777

Please sign in to comment.