How to use the io-functions-commons/dist/src/utils/errors.ExpiredError function in io-functions-commons

To help you get started, we’ve selected a few io-functions-commons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github teamdigitale / io-functions / lib / emailnotifications_queue_handler.ts View on Github external
notificationDefaultParams: INotificationDefaults
): Promise> {
  const {
    message,
    content,
    notificationId,
    senderMetadata
  } = emailNotificationEvent;

  // Check if the message is not expired
  const errorOrActiveMessage = ActiveMessage.decode(message);

  if (isLeft(errorOrActiveMessage)) {
    // if the message is expired no more processing is necessary
    return left(
      ExpiredError(
        `Message expired|notification=${notificationId}|message=${message.id}`
      )
    );
  }

  // fetch the notification
  const errorOrMaybeNotification = await lNotificationModel.find(
    notificationId,
    message.id
  );

  if (isLeft(errorOrMaybeNotification)) {
    const error = errorOrMaybeNotification.value;
    // we got an error while fetching the notification
    return left(
      TransientError(
github teamdigitale / io-functions / lib / webhook_queue_handler.ts View on Github external
webhookNotificationEvent: NotificationEvent
): Promise> {
  const {
    content,
    message,
    notificationId,
    senderMetadata
  } = webhookNotificationEvent;

  // Check if the message is not expired
  const errorOrActiveMessage = ActiveMessage.decode(message);

  if (isLeft(errorOrActiveMessage)) {
    // if the message is expired no more processing is necessary
    return left(
      ExpiredError(
        `Message expired|notification=${notificationId}|message=${message.id}`
      )
    );
  }

  // fetch the notification
  const errorOrMaybeNotification = await lNotificationModel.find(
    notificationId,
    message.id
  );

  if (isLeft(errorOrMaybeNotification)) {
    const error = errorOrMaybeNotification.value;
    // we got an error while fetching the notification
    return left(
      TransientError(

io-functions-commons

Common code for Azure functions

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Similar packages