dataOrThrow property

T get dataOrThrow

Throws ShopifyGraphQLException if the response contains errors.

Implementation

T get dataOrThrow {
  if (hasErrors) {
    throw ShopifyGraphQLException(
      errors!.map((e) => e.message).join('; '),
      errors: errors!,
    );
  }
  if (data == null) {
    throw const ShopifyGraphQLException(
      'No data in response',
      errors: [],
    );
  }
  return data as T;
}