Skip to content

The open alternative to Salesforce, designed for AI.

426 B
Raw Blame
import { isNonEmptyString } from '@sniptt/guards';

export const isGracefullyHandledEventStreamError = ({
  subCode,
  code,
}: {
  subCode?: unknown;
  code?: unknown;
}) => {
  if (!isNonEmptyString(subCode) && !isNonEmptyString(code)) {
    return false;
  }

  return (
    subCode === 'EVENT_STREAM_ALREADY_EXISTS' ||
    subCode === 'NOT_AUTHORIZED' ||
    code === 'UNAUTHENTICATED' ||
    code === 'FORBIDDEN'
  );
};