Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderDetailComponent not handling all ErrorResults from addFulfillmentToOrder #929

Closed
michaelbromley opened this issue Jun 11, 2021 · 0 comments
Assignees
Labels

Comments

@michaelbromley
Copy link
Member

Describe the bug
In the Admin UI, when creating a fulfillment, not all the possible ErrorResult types are being handled in the UI code. For example, CreateFulfillmentError is silently ignored.

The code in question is here:

switch (result.addFulfillmentToOrder.__typename) {
case 'Fulfillment':
this.notificationService.success(_('order.create-fulfillment-success'));
break;
case 'EmptyOrderLineSelectionError':
case 'InsufficientStockOnHandError':
case 'ItemsAlreadyFulfilledError':
this.notificationService.error(result.addFulfillmentToOrder.message);
break;
}

To Reproduce
Steps to reproduce the behavior:

  1. Create a FulfillmentHandler which throws an error
  2. Attempt a fulfillment with that handler
  3. No error feedback in the UI

Expected behavior
Display error notification for all error types. We should add an assertNever clause as an exhaustiveness check here.

Environment (please complete the following information):

  • @vendure/core version: 1.0.2
  • Nodejs version: any
  • Database (mysql/postgres etc): any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant