
import os
import sys


CONFIG_VAR_NAME = 'BYCEPS_CONFIG'


def get_config_filename_from_env() -> str:
    """Return the configuration filename set via environment variable.

    Raise an exception if it isn't set.
    """
    env = os.environ.get(CONFIG_VAR_NAME)

    if not env:
        raise Exception(
            "No configuration file was specified via the '{}' "
            "environment variable.".format(CONFIG_VAR_NAME))

    return env


def get_config_filename_from_env_or_exit() -> str:
    """Return the configuration filename set via environment variable.

    Exit if it isn't set.
    """
    try:
        return get_config_filename_from_env()
    except Exception as e:
        sys.stderr.write("{}\n".format(e))
        sys.exit(1)


import os
import sys

from ..config import ConfigurationError


CONFIG_VAR_NAME = 'BYCEPS_CONFIG'


def get_config_filename_from_env() -> str:
    """Return the configuration filename set via environment variable.

    Raise an exception if it isn't set.
    """
    env = os.environ.get(CONFIG_VAR_NAME)

    if not env:
        raise ConfigurationError(
            "No configuration file was specified via the '{}' "
            "environment variable.".format(CONFIG_VAR_NAME))

    return env


def get_config_filename_from_env_or_exit() -> str:
    """Return the configuration filename set via environment variable.

    Exit if it isn't set.
    """
    try:
        return get_config_filename_from_env()
    except ConfigurationError as e:
        sys.stderr.write("{}\n".format(e))
        sys.exit(1)

Raise `ConfigurationError` instead of `Exception` if environment variable `BYCEPS_CONFIG` is not set
Raise `ConfigurationError` instead of `Exception` if environment variable `BYCEPS_CONFIG` is not set

  
  import os
  import sys
+ 
+ from ..config import ConfigurationError
  
  
  CONFIG_VAR_NAME = 'BYCEPS_CONFIG'
  
  
  def get_config_filename_from_env() -> str:
      """Return the configuration filename set via environment variable.
  
      Raise an exception if it isn't set.
      """
      env = os.environ.get(CONFIG_VAR_NAME)
  
      if not env:
-         raise Exception(
+         raise ConfigurationError(
              "No configuration file was specified via the '{}' "
              "environment variable.".format(CONFIG_VAR_NAME))
  
      return env
  
  
  def get_config_filename_from_env_or_exit() -> str:
      """Return the configuration filename set via environment variable.
  
      Exit if it isn't set.
      """
      try:
          return get_config_filename_from_env()
-     except Exception as e:
+     except ConfigurationError as e:
          sys.stderr.write("{}\n".format(e))
          sys.exit(1)
  
Raise `ConfigurationError` instead of `Exception` if environment variable `BYCEPS_CONFIG` is not set
## Code Before:

import os
import sys


CONFIG_VAR_NAME = 'BYCEPS_CONFIG'


def get_config_filename_from_env() -> str:
    """Return the configuration filename set via environment variable.

    Raise an exception if it isn't set.
    """
    env = os.environ.get(CONFIG_VAR_NAME)

    if not env:
        raise Exception(
            "No configuration file was specified via the '{}' "
            "environment variable.".format(CONFIG_VAR_NAME))

    return env


def get_config_filename_from_env_or_exit() -> str:
    """Return the configuration filename set via environment variable.

    Exit if it isn't set.
    """
    try:
        return get_config_filename_from_env()
    except Exception as e:
        sys.stderr.write("{}\n".format(e))
        sys.exit(1)

## Instruction:
Raise `ConfigurationError` instead of `Exception` if environment variable `BYCEPS_CONFIG` is not set
## Code After:

import os
import sys

from ..config import ConfigurationError


CONFIG_VAR_NAME = 'BYCEPS_CONFIG'


def get_config_filename_from_env() -> str:
    """Return the configuration filename set via environment variable.

    Raise an exception if it isn't set.
    """
    env = os.environ.get(CONFIG_VAR_NAME)

    if not env:
        raise ConfigurationError(
            "No configuration file was specified via the '{}' "
            "environment variable.".format(CONFIG_VAR_NAME))

    return env


def get_config_filename_from_env_or_exit() -> str:
    """Return the configuration filename set via environment variable.

    Exit if it isn't set.
    """
    try:
        return get_config_filename_from_env()
    except ConfigurationError as e:
        sys.stderr.write("{}\n".format(e))
        sys.exit(1)
