added graceful error handling to getNewPrompt
This commit is contained in:
parent
3187a37483
commit
0f66d9a859
|
@ -21,6 +21,9 @@ export default async function getNewPrompt({ minCount = 200000, maxCount = 30000
|
||||||
.whereRaw('length(word) > 3')
|
.whereRaw('length(word) > 3')
|
||||||
.whereNotNull('pronunciation')
|
.whereNotNull('pronunciation')
|
||||||
.orderByRaw('count desc')
|
.orderByRaw('count desc')
|
||||||
|
.catch(error=>{return error})
|
||||||
|
|
||||||
|
if(prompts instanceof Error){return prompts}
|
||||||
|
|
||||||
const getBiasedRng = (min, max, bias, influence) => {
|
const getBiasedRng = (min, max, bias, influence) => {
|
||||||
const random = Math.random() * (max - min) + min
|
const random = Math.random() * (max - min) + min
|
||||||
|
@ -44,7 +47,9 @@ export default async function getNewPrompt({ minCount = 200000, maxCount = 30000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.dir(await getNewPrompt({}))
|
|
||||||
|
|
||||||
|
//console.dir(await getNewPrompt({}))
|
||||||
|
|
||||||
//console.log(await blocklist)
|
//console.log(await blocklist)
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ export default async function insertPublished(res, word){
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
return error.message
|
return error
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue