Log post creation failures (#2205)
parent
1111108efe
commit
a0d006a1ac
|
@ -104,12 +104,18 @@ export async function post(agent: BskyAgent, opts: PostOpts) {
|
||||||
|
|
||||||
// add image embed if present
|
// add image embed if present
|
||||||
if (opts.images?.length) {
|
if (opts.images?.length) {
|
||||||
|
logger.info(`Uploading images`, {
|
||||||
|
count: opts.images.length,
|
||||||
|
})
|
||||||
|
|
||||||
const images: AppBskyEmbedImages.Image[] = []
|
const images: AppBskyEmbedImages.Image[] = []
|
||||||
for (const image of opts.images) {
|
for (const image of opts.images) {
|
||||||
opts.onStateChange?.(`Uploading image #${images.length + 1}...`)
|
opts.onStateChange?.(`Uploading image #${images.length + 1}...`)
|
||||||
|
logger.info(`Compressing image`)
|
||||||
await image.compress()
|
await image.compress()
|
||||||
const path = image.compressed?.path ?? image.path
|
const path = image.compressed?.path ?? image.path
|
||||||
const {width, height} = image.compressed || image
|
const {width, height} = image.compressed || image
|
||||||
|
logger.info(`Uploading image`)
|
||||||
const res = await uploadBlob(agent, path, 'image/jpeg')
|
const res = await uploadBlob(agent, path, 'image/jpeg')
|
||||||
images.push({
|
images.push({
|
||||||
image: res.data.blob,
|
image: res.data.blob,
|
||||||
|
|
|
@ -62,6 +62,7 @@ import {useProfileQuery} from '#/state/queries/profile'
|
||||||
import {useComposerControls} from '#/state/shell/composer'
|
import {useComposerControls} from '#/state/shell/composer'
|
||||||
import {emitPostCreated} from '#/state/events'
|
import {emitPostCreated} from '#/state/events'
|
||||||
import {ThreadgateSetting} from '#/state/queries/threadgate'
|
import {ThreadgateSetting} from '#/state/queries/threadgate'
|
||||||
|
import {logger} from '#/logger'
|
||||||
|
|
||||||
type Props = ComposerOpts
|
type Props = ComposerOpts
|
||||||
export const ComposePost = observer(function ComposePost({
|
export const ComposePost = observer(function ComposePost({
|
||||||
|
@ -228,6 +229,11 @@ export const ComposePost = observer(function ComposePost({
|
||||||
})
|
})
|
||||||
).uri
|
).uri
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
logger.error(e, {
|
||||||
|
message: `Composer: create post failed`,
|
||||||
|
hasImages: gallery.size > 0,
|
||||||
|
})
|
||||||
|
|
||||||
if (extLink) {
|
if (extLink) {
|
||||||
setExtLink({
|
setExtLink({
|
||||||
...extLink,
|
...extLink,
|
||||||
|
|
Loading…
Reference in New Issue