From fb72b0a8f0833bd9f800a29498cc640ea2576275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20Tanr=C4=B1kulu?= Date: Tue, 13 Oct 2020 17:06:52 +0200 Subject: [PATCH] suppress and log the proposal error (#24) * suppress and log the proposal error * version bump --- examples/package.json | 2 +- package.json | 2 +- yajsapi/runner/index.ts | 19 ++++++++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/examples/package.json b/examples/package.json index 18f5d5773..43692a67a 100644 --- a/examples/package.json +++ b/examples/package.json @@ -15,7 +15,7 @@ "bluebird": "^3.5.0", "dayjs": "^1.8.31", "ts-node": "^9.0.0", - "yajsapi": "0.1.0-alpha.1" + "yajsapi": "0.1.0-alpha.2" }, "devDependencies": { "tsconfig-paths": "^3.9.0", diff --git a/package.json b/package.json index 7a3d3f21e..801b3c7e9 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yajsapi", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "description": "NodeJS API for Next Golem", "repository": "https://github.com/golemfactory/yajsapi", "main": "dist/index.js", diff --git a/yajsapi/runner/index.ts b/yajsapi/runner/index.ts index 16ef2170d..4aae8844c 100755 --- a/yajsapi/runner/index.ts +++ b/yajsapi/runner/index.ts @@ -310,9 +310,13 @@ export class Engine { proposal.id(), proposal.issuer(), ]; - // with contextlib.suppress(Exception): - await proposal.reject(); - emit_progress("prop", "rejected", proposal_id, provider_id); + try { + await proposal.reject(); + emit_progress("prop", "rejected", proposal_id, provider_id); + } catch(error) { + //suppress and log the error and continue; + logger.log('debug', `Reject error: ${error}`); + } continue; } if (proposal.is_draft()) { @@ -328,8 +332,13 @@ export class Engine { proposal ); } else { - await proposal.respond(builder.props(), builder.cons()); - emit_progress("prop", "respond", proposal.id()); + try { + await proposal.respond(builder.props(), builder.cons()); + emit_progress("prop", "respond", proposal.id()); + } catch(error) { + //suppress and log the error and continue; + logger.log('debug', `Respond error: ${error}`); + } } } }