fix crashes and report which object failed in walletd

This commit is contained in:
keyan 2021-08-12 16:21:56 -05:00
parent 89b8e391c9
commit 1d6e301b10
4 changed files with 18 additions and 5 deletions

View File

@ -122,7 +122,9 @@ export default {
${SELECT}
FROM "Item"
WHERE id = $1`, Number(id))
item.comments = comments(models, id)
if (item) {
item.comments = comments(models, id)
}
return item
},
userComments: async (parent, { userId }, { models }) => {

View File

@ -4,8 +4,13 @@ import path from 'path'
export default async function handler (req, res) {
const url = process.env.SELF_URL + '/' + path.join(...(req.query.path || []))
res.setHeader('Content-Type', 'image/png')
const streams = await new Pageres({ crop: true })
try {
const streams = await new Pageres({ crop: true })
.src(url, ['600x300'])
.run()
res.status(200).end(streams[0])
res.status(200).end(streams[0])
} catch(e) {
console.log(e)
res.status(500)
}
}

View File

@ -13,6 +13,12 @@ import ApolloClient from '../../api/client'
// ssr the item without comments so that we can populate metatags
export async function getServerSideProps ({ req, params: { id } }) {
if (isNaN(id)) {
return {
notFound: true
}
}
const { error, data: { item } } = await (await ApolloClient(req)).query({
query:
gql`

View File

@ -57,7 +57,7 @@ async function checkPendingInvoices () {
const inv = await getInvoice({ id: invoice.hash, lnd })
await recordInvoiceStatus(inv)
} catch (error) {
console.log(error)
console.log(invoice, error)
process.exit(1)
}
})
@ -106,7 +106,7 @@ async function checkPendingWithdrawls () {
const wdrwl = await getPayment({ id: withdrawl.hash, lnd })
await recordWithdrawlStatus(withdrawl.id, wdrwl)
} catch (error) {
console.log(error)
console.log(withdrawl, error)
process.exit(1)
}
})