Global DominosErrors

March 12, 2021 ยท View on GitHub

These custom errors are added to the global object for use in your code and the dominos api. You can use them to validate errors or even throw your own if you are making a module ontop of this one.

errorparametersdescription
DominosValidationError.validationResponsethis error is thrown when a dominos validation request fails
DominosPriceError.priceResponsethis error is thrown when a dominos price request fails
DominosPlaceOrderError.placeOrderResponsethis error is thrown when a dominos place request fails
DominosTrackingErrormessage stringthis error is thrown when no trackable orders are found for a phone number
DominosAddressErrormessage stringthis error is thrown when an issue is detected with a dominos address
DominosDateErrormessage stringthis error is thrown when an issue is detected with a date being used for a dominos order
DominosStoreErrormessage stringthis error is thrown when an issue is detected with a store being used for a dominos order
DominosProductsErrormessage stringthis error is thrown when an issue is detected with an orders product list

throw new DominosValidationError(order.validationResponse);

throw new DominosPriceError(order.priceResponse);

throw new DominosPlaceOrderError(order.placeResponse);

throw new DominosTrackingError('No orders found for this phone number.');

throw new DominosAddressError('before you place an order, you must insure `order.address.region` is set');

throw new DominosDateError('Order dates must be in the future.');

throw new DominosStoreError('`order.storeID` must be specified before placing order.');

throw new DominosProductsError('`order.products` must contain atleast one item before placing order.');