import { DataAccessError } from './data-access.error';

/**
 * Error thrown when a required property is null or undefined.
 *
 * @remarks
 * This error indicates that a non-null, non-undefined property has been found to be invalid.
 *
 * @param parameterName - The name of the property that is null or undefined.
 *
 * @example
 * throw new PropertyNullOrUndefinedError('userId');
 */
export class PropertyNullOrUndefinedError extends DataAccessError<'PROPERTY_NULL_OR_UNDEFINED'> {
  constructor(propertyName: string) {
    super(
      'PROPERTY_NULL_OR_UNDEFINED',
      `Property "${propertyName}" is null or undefined.`,
    );
  }
}
