Default handling of exceptions on rasa server

Hi together,

I just have some question: is there a reason that exceptions occuring on the rasa server are logged only when running rasa in the debug mode? I assume nobody wants error messages, however I think that exceptions are not something that should be printed only as “debug” information. Here the warning type would (from my opinion) be better suited.

In addition, I think it could be beneficial to have some information about an exception within the tracker database (although I know this information does not fit well into the tracker store…)

Thanks and all the best, Martin

I might need to ask somebody on our engineering teams if there’s a reason for this but I agree that it does sound … strange.

Do you have an example of such an error message?

Hi,

the simplest way to get an exception is to implement a new Rasa component and add an error into the process part (here we have a component, that divides by zero when processing):

import typing
from typing import Any, Optional, Text, Dict, List, Type

from rasa.nlu.components import Component
from rasa.nlu.config import RasaNLUModelConfig
from rasa.nlu.training_data import Message, TrainingData

if typing.TYPE_CHECKING:
    from rasa.nlu.model import Metadata


class DivideByZero(Component):

    @classmethod
    def required_components(cls) -> List[Type[Component]]:
        return []

    defaults = {"alias": None}
    language_list = None

    def __init__(self, component_config: Optional[Dict[Text, Any]] = None) -> None:
        super().__init__(component_config)

    def train(
            self,
            training_data: TrainingData,
            config: Optional[RasaNLUModelConfig] = None,
            **kwargs: Any,
    ) -> None:
        pass

    def process(self, message: Message, **kwargs: Any) -> None:
        K = 1 / 0

    def persist(self, file_name: Text, model_dir: Text) -> Optional[Dict[Text, Any]]:
        pass

    @classmethod
    def load(
            cls,
            meta: Dict[Text, Any],
            model_dir: Optional[Text] = None,
            model_metadata: Optional["Metadata"] = None,
            cached_component: Optional["Component"] = None,
            **kwargs: Any,
    ) -> "Component":
        """Load this component from file."""

        if cached_component:
            return cached_component
        else:
            return cls(meta)

and use that component in the pipeline (config.yml) and train and test. Correctly, we get a errorneous http response. However, the error itself is not printed on the rasa server.

Best Martin

Hi Vincent,

did you already got some response to that behaviour?

Best, Martin

Hi together,

to “solve”/explain that issue I looked into the sourcecode. The reason for the strange behavior comes from using rasa 1.8. Here the error responses are not written to the standard output only in debug modus (rasa/server.py at 1.8.0 · RasaHQ/rasa · GitHub). Since Rasa 2.0.0 the exception itself is still logged in debug modus (which is somehow ok), but the error message is written as warning within the ErrorResponse class (rasa/server.py at 2.0.0 · RasaHQ/rasa · GitHub).

Best, Martin