<commit_before>"""Exceptions used in Cubes.

The base exception calss is :class:`.CubesError`."""

class ConfigurationError(Exception):
    """Raised when there is a problem with workspace configuration assumed."""

class CubesError(Exception):
    """Generic error class."""

class ModelError(CubesError):
    """Model related exception."""

class ModelInconsistencyError(ModelError):
    """Raised when there is incosistency in model structure."""

class MissingObjectError(ModelError):
    def __init__(self, name, reason=None):
        self.name = name
        self.reason = reason

    def __str__(self):
        return self.name

class NoSuchDimensionError(MissingObjectError):
    """Raised when an unknown dimension is requested."""

class NoSuchCubeError(MissingObjectError):
    """Raised when an unknown cube is requested."""

class TemplateRequired(ModelError):
    """Raised by a model provider which can provide a dimension, but requires
    a template. Signals to the caller that the creation of a dimension should
    be retried when the template is available."""

    def __init__(self, template):
        self.template = template
    def __str__(self):
        return self.template

class NoSuchAttributeError(ModelError):
    """Raised when an unknown attribute, measure or detail requested."""

class ArgumentError(CubesError):
    """Raised when an invalid or conflicting function argument is supplied.
    """

class BackendError(CubesError):
    """Raised by a backend. Should be handled separately, for example: should
    not be passed to the client from the server due to possible internal
    schema exposure.
    """

class MappingError(BackendError):
    """Raised when there are issues by mapping from logical model to physical
    database schema. """

class WorkspaceError(CubesError):
    """Backend Workspace related exception."""

class BrowserError(CubesError):
    """AggregationBrowser related exception."""
    pass

class HierarchyError(CubesError):
    """Raised when attemt to get level deeper than deepest level in a
    hierarchy"""<commit_msg>new exception hierarchy: UserError (publishable to frontent), InternalError (keep the message private)<commit_after>"""Exceptions used in Cubes.

The base exception calss is :class:`.CubesError`."""

class CubesError(Exception):
    """Generic error class."""

class UserError(CubesError):
    """Superclass for all errors caused by the cubes and slicer users. Error
    messages from this error might be safely passed to the front-end. Do not
    include any information that you would not like to be public"""

class InternalError(CubesError):
    """Superclass for all errors that happened internally: configuration
    issues, connection problems, model inconsistencies..."""

class ConfigurationError(InternalError):
    """Raised when there is a problem with workspace configuration assumed."""

class BackendError(InternalError):
    """Raised by a backend. Should be handled separately, for example: should
    not be passed to the client from the server due to possible internal
    schema exposure.
    """

class WorkspaceError(InternalError):
    """Backend Workspace related exception."""

class BrowserError(InternalError):
    """AggregationBrowser related exception."""
    pass

class ModelError(InternalError):
    """Model related exception."""

# TODO: necessary? or rename to PhysicalModelError
class MappingError(ModelError):
    """Raised when there are issues by mapping from logical model to physical
    database schema. """


# TODO: change all instances to ModelError 
class ModelInconsistencyError(ModelError):
    """Raised when there is incosistency in model structure."""

class TemplateRequired(ModelError):
    """Raised by a model provider which can provide a dimension, but requires
    a template. Signals to the caller that the creation of a dimension should
    be retried when the template is available."""

    def __init__(self, template):
        self.template = template
    def __str__(self):
        return self.template

class MissingObjectError(UserError):
    def __init__(self, name, reason=None):
        self.name = name
        self.reason = reason

    def __str__(self):
        return self.name

class NoSuchDimensionError(MissingObjectError):
    """Raised when an unknown dimension is requested."""

class NoSuchCubeError(MissingObjectError):
    """Raised when an unknown cube is requested."""

class NoSuchAttributeError(UserError):
    """Raised when an unknown attribute, measure or detail requested."""

class ArgumentError(UserError):
    """Raised when an invalid or conflicting function argument is supplied.
    """

class HierarchyError(UserError):
    """Raised when attemt to get level deeper than deepest level in a
    hierarchy"""

{'fraction_non_alphanumeric': 0.08639398998330551, 'fraction_numerical': 0.0, 'mean_word_length': 4.209782608695652, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3462124', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1173, 'n_words': 497}