-
Notifications
You must be signed in to change notification settings - Fork 19
Feature: Move order into a placed
state
#66
Conversation
1 similar comment
*/ | ||
nextTransition: function (transitionName, ...args) { | ||
this.logger.debug(`Queuing transition: ${transitionName}`) | ||
process.nextTick(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the reasoning for using nextTick
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't move to another transition while you're still in one. nextTick
gets you out of the current transition. See this issue: jakesgordon/javascript-state-machine#143
let error | ||
|
||
if (this.error) { | ||
error = this.error.message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when would an error not have a message in our code? Do our custom errors not implement this correctly?
} | ||
|
||
const { state, history } = this | ||
let error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] would change this to errorMessage
to be more specific
|
||
const stateMachine = { state, history, error } | ||
|
||
const value = JSON.stringify(Object.assign(valueObject, { __stateMachine: stateMachine })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need to for this PR, but would be worth it to throw this into its own serialize/deserialize method, in the same way we have fromStore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was part of the desire for #67
LGTM |
Description
This PR adds a placeholder for the
placed
state transition and adds background error handling for individual orders to handle the case where the order is rejected while being placed.It also moves state machines to their own directory, since it is really outside the scope of simply the block order worker
Related PRs
None
Todos