Source code for formulas.errors
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2016-2023 European Commission (JRC);
# Licensed under the EUPL (the 'Licence');
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
"""
Defines the formulas exception.
"""
[docs]
class BaseError(Exception):
msg = ''
def __init__(self, *args):
super(BaseError, self).__init__(self.msg, *args)
[docs]
class FoundError(BaseError):
# noinspection PyUnusedLocal
def __init__(self, *args, err=None, **kwargs):
self.err = err
[docs]
class TokenError(FormulaError):
msg = 'Invalid string: %s'
[docs]
class ParenthesesError(FormulaError):
msg = 'Mismatched or misplaced parentheses!'
[docs]
class FunctionError(FormulaError):
msg = 'Function not implemented!'
[docs]
class InvalidRangeError(BaseError):
msg = 'Invalid range %s!'
[docs]
class RangeValueError(BaseError):
msg = 'Range %s has not value!'
[docs]
class BroadcastError(BaseError):
msg = 'Broadcast is not implemented!'
[docs]
class InvalidRangeName(ValueError):
def _raise(self):
raise self