protected function getRouterException($code) {
        $errors = [
            RouterInterface::ERROR_NOT_FOUND => NotFoundException::class,
            RouterInterface::ERROR_METHOD_NOT_ALLOWED => MethodNotAllowedException::class,
            '*' => NotSupportedException::class,
        ];
        $errorClass = isset($errors[$code]) ? $errors[$code] : $errors['*'];
        try {
            $exception = Reaction::create($errorClass);
        } catch (InvalidConfigException $createException) {
            return $createException;
        }
        return $exception;
    }