dc6079821b
CI Github Actions / Run Tests (push) Waiting to run
Automatic PR Merger / mergepal (push) Waiting to run
Semgrep / Semgrep Workflow Security Scan (push) Waiting to run
Docs Tests / Check for file changes (push) Has been cancelled
Docs Tests / Test Documentation (push) Has been cancelled
Docs Tests / Documentation Linting Checks (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-policies) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.10) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.8) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.9) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.10) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.8) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.9) (push) Has been cancelled
Continuous Integration / Check for file changes (push) Has been cancelled
Continuous Integration / Wait for docs tests (push) Has been cancelled
Continuous Integration / Code Quality (push) Has been cancelled
Continuous Integration / Check for changelog (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Upload coverage reports to codeclimate (push) Has been cancelled
Continuous Integration / Run Non-Sequential Integration Tests (push) Has been cancelled
Continuous Integration / Run Broker Integration Tests (push) Has been cancelled
Continuous Integration / Run Sequential Integration Tests (push) Has been cancelled
Continuous Integration / Build Docker base images and setup environment (push) Has been cancelled
Continuous Integration / Build Docker (default) (push) Has been cancelled
Continuous Integration / Build Docker (full) (push) Has been cancelled
Continuous Integration / Build Docker (mitie-en) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-de) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-en) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-it) (push) Has been cancelled
Continuous Integration / Deploy to PyPI (push) Has been cancelled
Continuous Integration / Notify Slack & Publish Release Notes (push) Has been cancelled
Publish Documentation / Evaluate release tag (push) Has been cancelled
Publish Documentation / Prebuild Docs (push) Has been cancelled
Publish Documentation / Preview Docs (push) Has been cancelled
Publish Documentation / Check for file changes (push) Has been cancelled
Publish Documentation / Publish Docs (push) Has been cancelled
119 lines
3.5 KiB
Python
119 lines
3.5 KiB
Python
import json
|
|
from typing import Optional, Text
|
|
|
|
import jsonschema
|
|
from ruamel.yaml.error import (
|
|
MarkedYAMLError,
|
|
MarkedYAMLWarning,
|
|
MarkedYAMLFutureWarning,
|
|
)
|
|
|
|
|
|
class RasaException(Exception):
|
|
"""Base exception class for all errors raised by Rasa Open Source.
|
|
|
|
These exceptions result from invalid use cases and will be reported
|
|
to the users, but will be ignored in telemetry.
|
|
"""
|
|
|
|
|
|
class RasaCoreException(RasaException):
|
|
"""Basic exception for errors raised by Rasa Core."""
|
|
|
|
|
|
class InvalidParameterException(RasaException, ValueError):
|
|
"""Raised when an invalid parameter is used."""
|
|
|
|
|
|
class YamlException(RasaException):
|
|
"""Raised if there is an error reading yaml."""
|
|
|
|
def __init__(self, filename: Optional[Text] = None) -> None:
|
|
"""Create exception.
|
|
|
|
Args:
|
|
filename: optional file the error occurred in"""
|
|
self.filename = filename
|
|
|
|
|
|
class YamlSyntaxException(YamlException):
|
|
"""Raised when a YAML file can not be parsed properly due to a syntax error."""
|
|
|
|
def __init__(
|
|
self,
|
|
filename: Optional[Text] = None,
|
|
underlying_yaml_exception: Optional[Exception] = None,
|
|
) -> None:
|
|
super(YamlSyntaxException, self).__init__(filename)
|
|
|
|
self.underlying_yaml_exception = underlying_yaml_exception
|
|
|
|
def __str__(self) -> Text:
|
|
if self.filename:
|
|
exception_text = f"Failed to read '{self.filename}'."
|
|
else:
|
|
exception_text = "Failed to read YAML."
|
|
|
|
if self.underlying_yaml_exception:
|
|
if isinstance(
|
|
self.underlying_yaml_exception,
|
|
(MarkedYAMLError, MarkedYAMLWarning, MarkedYAMLFutureWarning),
|
|
):
|
|
self.underlying_yaml_exception.note = None
|
|
if isinstance(
|
|
self.underlying_yaml_exception,
|
|
(MarkedYAMLWarning, MarkedYAMLFutureWarning),
|
|
):
|
|
self.underlying_yaml_exception.warn = None
|
|
exception_text += f" {self.underlying_yaml_exception}"
|
|
|
|
if self.filename:
|
|
exception_text = exception_text.replace(
|
|
'in "<unicode string>"', f'in "{self.filename}"'
|
|
)
|
|
|
|
exception_text += (
|
|
"\n\nYou can use https://yamlchecker.com/ to validate the "
|
|
"YAML syntax of your file."
|
|
)
|
|
return exception_text
|
|
|
|
|
|
class FileNotFoundException(RasaException, FileNotFoundError):
|
|
"""Raised when a file, expected to exist, doesn't exist."""
|
|
|
|
|
|
class FileIOException(RasaException):
|
|
"""Raised if there is an error while doing file IO."""
|
|
|
|
|
|
class InvalidConfigException(ValueError, RasaException):
|
|
"""Raised if an invalid configuration is encountered."""
|
|
|
|
|
|
class UnsupportedFeatureException(RasaCoreException):
|
|
"""Raised if a requested feature is not supported."""
|
|
|
|
|
|
class SchemaValidationError(RasaException, jsonschema.ValidationError):
|
|
"""Raised if schema validation via `jsonschema` failed."""
|
|
|
|
|
|
class InvalidEntityFormatException(RasaException, json.JSONDecodeError):
|
|
"""Raised if the format of an entity is invalid."""
|
|
|
|
@classmethod
|
|
def create_from(
|
|
cls, other: json.JSONDecodeError, msg: Text
|
|
) -> "InvalidEntityFormatException":
|
|
"""Creates `InvalidEntityFormatException` from `JSONDecodeError`."""
|
|
return cls(msg, other.doc, other.pos)
|
|
|
|
|
|
class ConnectionException(RasaException):
|
|
"""Raised when a connection to a 3rd party service fails.
|
|
|
|
It's used by our broker and tracker store classes, when
|
|
they can't connect to services like postgres, dynamoDB, mongo.
|
|
"""
|