planFeatureDeniedFailure function
FailureException
planFeatureDeniedFailure(
- ProcurementDeniedException e,
- StackTrace s, {
- required PlanFeature feature,
- required String projectId,
- required String failureMessage,
Maps a ProcurementDeniedException to the failure shown to the user.
A denial because the plan of projectId does not include feature becomes
a failure with the server message and the plan upgrade hint. Any other
denial becomes a nested failure with failureMessage.
Implementation
FailureException planFeatureDeniedFailure(
final ProcurementDeniedException e,
final StackTrace s, {
required final PlanFeature feature,
required final String projectId,
required final String failureMessage,
}) {
if (e.reason != ProcurementDeniedReason.productNotAvailable) {
return FailureException.nested(e, s, failureMessage);
}
return FailureException(
error: e.message,
hint: feature.upgradeHint(projectId),
);
}