Skip to content

Commit

Permalink
Merge pull request #305 from forta-network/reject-promise-on-python-e…
Browse files Browse the repository at this point in the history
…rror

reject promise on python error
  • Loading branch information
haseebrabbani authored May 7, 2023
2 parents e060ba1 + ab8b907 commit 5fe03cb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cli/utils/get.python.agent.handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,16 @@ while True:
resolve(findings)
delete promiseCallbackMap[hash]
})
.on("stderr", function (err) {
.on("stderr", (err) => {
console.log(err)
})
.on("pythonError",(err) => {
const hash = Object.keys(promiseCallbackMap)[0]
if (hash && promiseCallbackMap[hash]) {
const { reject } = promiseCallbackMap[hash]
reject(err)
}
})
let pythonShell = createPythonShell()

return function handler(event: TransactionEvent | AlertEvent | BlockEvent | undefined) {
Expand Down

0 comments on commit 5fe03cb

Please # to comment.