import notification from 'utils/notification'

/**
 * Warn a user via a notification component before throwing an error with the same message.
 * Useful utility for rejections during antd form `onFinish` submissions
 *
 * @param {string} message The displayed notification message
 */
export const warnAndThrow = (message: string) => {
  notification.warn({ message })
  throw new Error(message)
}
