Error helper for integrations
Use this package to make good and actionable error messages for your ordering integration.
What is an actionable error message?
An error message should contain as much information as possible to help who sees the error to take an action to promptly fix it.
A bad error message, for example, is the following:
There was an unknown error sending the order to the POS.
While a good one is, for example:
There is an invalid item in the payload, please contact the menu team to confirm the PLUs are correct. POS Error message: [-956234774] Invalid database object detected: 1234
This message is composed by three parts:
- A text explaining the error occurred
- Who needs to be contacted to investigate / fix the problem
- The original POS message
With a well defined error message like the above one, who spots the error knows immediately what the problem is and how to act in order to fix it.
Why using an npm module for that?
We decided to create a module in order to unify the error messages returned by the various integrations. We want, for example, that the error messages for an invalid tender type will be the same across all the integrations.
When I should use this module?
You should use this module in every integration. What you need to do on your integration is investigating on the error response returned from the POS and call this module methods that will create the error messages for you, with no hassle required to make sure they are the same all across the integrations.
Usage
Install
// Get back on this when the package is published on npm
How to use in in your integration
// Get back on this when the package is published on npm
Extending the error messages with a custom one
// Get back on this when the package is published on npm