<commit_before># -*- coding: utf-8 -*-


class IcebergError(Exception):
    pass

class IcebergMissingApplicationSettingsError(IcebergError):
    pass

class IcebergNoHandlerError(IcebergError):
    pass

class IcebergConnectionError(IcebergError):
    pass

class IcebergAuthenticationError(IcebergError):
    pass

class IcebergBadRequestError(IcebergError):
    pass

class IcebergTransitionError(IcebergError):
    pass


class IcebergInternalServerError(IcebergError):
    pass

class IcebergRateLimitExceeded(IcebergError):
    pass

class IcebergNotAuthorized(IcebergError):
    pass

class IcebergReadOnlyError(IcebergError):
    pass

# API
class IcebergAPIError(IcebergError):
    def __init__(self, response, url = None):
        self.status_code = response.status_code
        self.error_codes = []
        self.message = ''
        self.url = url

        try:
            self.data = response.json()
        except:
            self.data = response
        else:
            if 'errors' in self.data:
                for error in self.data['errors']:
                    self.error_codes.append(error['code'])
                    self.message += error['msg']
            if 'error' in self.data:
                self.message += self.data['error']['msg']

        Exception.__init__(self, self.message)
        
    def __str__(self):
        if len(self.message) > 0:
            message = self.message
        else:
            message = self.data
        return "Error in %s! %s : %s: %s" % (self.url, self.status_code, self.error_codes, message)

class IcebergServerError(IcebergAPIError):
    pass

class IcebergClientError(IcebergAPIError):
    pass

class IcebergClientUnauthorizedError(IcebergError):
    pass


<commit_msg>Fix error mgs without code<commit_after># -*- coding: utf-8 -*-


class IcebergError(Exception):
    pass

class IcebergMissingApplicationSettingsError(IcebergError):
    pass

class IcebergNoHandlerError(IcebergError):
    pass

class IcebergConnectionError(IcebergError):
    pass

class IcebergAuthenticationError(IcebergError):
    pass

class IcebergBadRequestError(IcebergError):
    pass

class IcebergTransitionError(IcebergError):
    pass


class IcebergInternalServerError(IcebergError):
    pass

class IcebergRateLimitExceeded(IcebergError):
    pass

class IcebergNotAuthorized(IcebergError):
    pass

class IcebergReadOnlyError(IcebergError):
    pass

# API
class IcebergAPIError(IcebergError):
    def __init__(self, response, url = None):
        self.status_code = response.status_code
        self.error_codes = []
        self.message = ''
        self.url = url

        try:
            self.data = response.json()
        except:
            self.data = response
        else:
            if 'errors' in self.data:
                for error in self.data['errors']:
                    if 'code' in error:
                        self.error_codes.append(error['code'])
                    self.message += error['msg']
            if 'error' in self.data:
                self.message += self.data['error']['msg']

        Exception.__init__(self, self.message)
        
    def __str__(self):
        if len(self.message) > 0:
            message = self.message
        else:
            message = self.data
        return "Error in %s! %s : %s: %s" % (self.url, self.status_code, self.error_codes, message)

class IcebergServerError(IcebergAPIError):
    pass

class IcebergClientError(IcebergAPIError):
    pass

class IcebergClientUnauthorizedError(IcebergError):
    pass



{'fraction_non_alphanumeric': 0.09331829715252325, 'fraction_numerical': 0.001127713560755568, 'mean_word_length': 2.5730110775427995, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3185730', 'n_tokens_mistral': 1052, 'n_tokens_neox': 1001, 'n_words': 220}