Skip to content

Commit

Permalink
change eci error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
b1conrad committed Dec 26, 2020
1 parent 960772a commit 547269a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/pico-engine-core/src/modules/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ const event: krl.Module = {
["options", "host"],
async function event(options, host) {
let eci = options.eci;
if (!krl.isString(eci)) {
throw new TypeError(
"eci was " +
krl.toString(eci) +
" instead of a string"
);
}
let domain = options.domain;
let name = options.name || options.type;
let attrs = options.attrs;
Expand All @@ -58,6 +65,8 @@ const event: krl.Module = {
name,
data: { attrs },
time: 0,
}).catch((err) => {
this.log.error(err + ""); // TODO better handling
});

return eid;
Expand Down

1 comment on commit 547269a

@b1conrad
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might fix issue #498 because it no longer breaks rule execution if an ECI is not found. It still checks for a null ECI and will stop rule execution in that case.

Please sign in to comment.