sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

"Object of class Doctrine\ORM\PersistentCollection could not be converted to string" when setting custom list template #6296

Closed kyeno closed 4 years ago

kyeno commented 4 years ago

5689 # Environment

Sonata packages

sonata-project/admin-bundle              3.73.0 3.73.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.20.0 4.3.0  Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/classification-bundle     3.13.0 3.13.0 Symfony SonataClassificationBundle
sonata-project/core-bundle               3.20.0 3.20.0 Symfony SonataCoreBundle (abandoned)
Package sonata-project/core-bundle is abandoned, you should avoid using it. No replacement was suggested.
sonata-project/datagrid-bundle           2.5.0  3.2.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.9.1  1.9.1  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.21.0 3.21.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  2.3.0  2.3.0  Lightweight Exporter library
sonata-project/form-extensions           0.1.2  1.6.0  Symfony form extensions
sonata-project/formatter-bundle          4.2.0  4.2.0  Symfony SonataFormatterBundle
sonata-project/intl-bundle               2.9.0  2.9.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.26.0 3.26.0 Symfony SonataMediaBundle
sonata-project/news-bundle               3.13.0 3.13.0 Symfony SonataNewsBundle
sonata-project/twig-extensions           0.1.1  1.4.1  Sonata twig extensions
sonata-project/user-bundle               4.7.0  4.7.0  Symfony SonataUserBundle

Symfony packages

symfony/asset                      v4.4.11 v4.4.11 Symfony Asset Component
symfony/browser-kit                v4.4.11 v4.4.11 Symfony BrowserKit Component
symfony/cache                      v4.4.11 v4.4.11 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v2.1.3  v2.1.3  Generic abstractions related to caching
symfony/config                     v4.4.11 v4.4.11 Symfony Config Component
symfony/console                    v4.4.11 v4.4.11 Symfony Console Component
symfony/css-selector               v4.4.11 v4.4.11 Symfony CssSelector Component
symfony/debug                      v4.4.11 v4.4.11 Symfony Debug Component
symfony/debug-bundle               v4.4.11 v4.4.11 Symfony DebugBundle
symfony/debug-pack                 v1.0.8  v1.0.8  A debug pack for Symfony projects
symfony/dependency-injection       v4.4.11 v4.4.11 Symfony DependencyInjection Component
symfony/doctrine-bridge            v4.4.11 v4.4.11 Symfony Doctrine Bridge
symfony/dom-crawler                v4.4.11 v4.4.11 Symfony DomCrawler Component
symfony/dotenv                     v4.4.11 v4.4.11 Registers environment variables from a .env file
symfony/error-handler              v4.4.11 v4.4.11 Symfony ErrorHandler Component
symfony/event-dispatcher           v4.4.11 v4.4.11 Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.9  v2.1.3  Generic abstractions related to dispatching event
symfony/expression-language        v4.4.11 v4.4.11 Symfony ExpressionLanguage Component
symfony/filesystem                 v4.4.11 v4.4.11 Symfony Filesystem Component
symfony/finder                     v4.4.11 v4.4.11 Symfony Finder Component
symfony/flex                       v1.9.1  v1.9.1  Composer plugin for Symfony
symfony/form                       v4.4.11 v4.4.11 Symfony Form Component
symfony/framework-bundle           v4.4.11 v4.4.11 Symfony FrameworkBundle
symfony/http-client                v4.4.11 v4.4.11 Symfony HttpClient component
symfony/http-client-contracts      v2.1.3  v2.1.3  Generic abstractions related to HTTP clients
symfony/http-foundation            v4.4.11 v4.4.11 Symfony HttpFoundation Component
symfony/http-kernel                v4.4.11 v4.4.11 Symfony HttpKernel Component
symfony/inflector                  v4.4.11 v4.4.11 Symfony Inflector Component
symfony/intl                       v4.4.11 v4.4.11 A PHP replacement layer for the C intl extension that includes additional data...
symfony/mailer                     v4.4.11 v4.4.11 Symfony Mailer Component
symfony/maker-bundle               v1.20.0 v1.20.0 Symfony Maker helps you create empty commands, controllers, form classes, test...
symfony/mime                       v4.4.11 v4.4.11 A library to manipulate MIME messages
symfony/monolog-bridge             v4.4.11 v4.4.11 Symfony Monolog Bridge
symfony/monolog-bundle             v3.5.0  v3.5.0  Symfony MonologBundle
symfony/options-resolver           v4.4.11 v4.4.11 Symfony OptionsResolver Component
symfony/orm-pack                   v2.0.0  v2.0.0  A pack for the Doctrine ORM
symfony/phpunit-bridge             v5.1.3  v5.1.3  Symfony PHPUnit Bridge
symfony/polyfill-intl-grapheme     v1.18.1 v1.18.1 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu          v1.18.1 v1.18.1 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.18.1 v1.18.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.18.1 v1.18.1 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.18.1 v1.18.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.18.1 v1.18.1 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.18.1 v1.18.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80             v1.18.1 v1.18.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process                    v4.4.11 v4.4.11 Symfony Process Component
symfony/profiler-pack              v1.0.5  v1.0.5  A pack for the Symfony web profiler
symfony/property-access            v4.4.11 v4.4.11 Symfony PropertyAccess Component
symfony/property-info              v4.4.11 v4.4.11 Symfony Property Info Component
symfony/routing                    v4.4.11 v4.4.11 Symfony Routing Component
symfony/security-acl               v3.1.0  v3.1.0  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.4.11 v4.4.11 Symfony SecurityBundle
symfony/security-core              v4.4.11 v4.4.11 Symfony Security Component - Core Library
symfony/security-csrf              v4.4.11 v4.4.11 Symfony Security Component - CSRF Library
symfony/security-guard             v4.4.11 v4.4.11 Symfony Security Component - Guard
symfony/security-http              v4.4.11 v4.4.11 Symfony Security Component - HTTP Integration
symfony/serializer                 v4.4.11 v4.4.11 Symfony Serializer Component
symfony/serializer-pack            v1.0.3  v1.0.3  A pack for the Symfony serializer
symfony/service-contracts          v2.1.3  v2.1.3  Generic abstractions related to writing services
symfony/stopwatch                  v4.4.11 v4.4.11 Symfony Stopwatch Component
symfony/string                     v5.1.3  v5.1.3  Symfony String component
symfony/templating                 v4.4.11 v4.4.11 Symfony Templating Component
symfony/test-pack                  v1.0.6  v1.0.6  A pack for functional and end-to-end testing within a Symfony app
symfony/translation                v4.4.11 v4.4.11 Symfony Translation Component
symfony/translation-contracts      v2.1.3  v2.1.3  Generic abstractions related to translation
symfony/twig-bridge                v4.4.11 v4.4.11 Symfony Twig Bridge
symfony/twig-bundle                v4.4.11 v4.4.11 Symfony TwigBundle
symfony/twig-pack                  v1.0.0  v1.0.0  A Twig pack for Symfony projects
symfony/validator                  v4.4.11 v4.4.11 Symfony Validator Component
symfony/var-dumper                 v4.4.11 v4.4.11 Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v4.4.11 v4.4.11 A blend of var_export() + serialize() to turn any serializable data structure ...
symfony/web-link                   v4.4.11 v4.4.11 Symfony WebLink Component
symfony/web-profiler-bundle        v4.4.11 v4.4.11 Symfony WebProfilerBundle
symfony/webpack-encore-bundle      v1.7.3  v1.7.3  Integration with your Symfony app & Webpack Encore!
symfony/yaml                       v4.4.11 v4.4.11 Symfony Yaml Component

PHP version

PHP 7.4.6

Doctrine ORM, MariaDB

Subject

Enabling template field in configureListFields() admin class method on self-referencing one-to-many (parent->children) relation causes critical error: Object of class Doctrine\ORM\PersistentCollection could not be converted to string

Steps to reproduce

  1. Create an entity with self-referencing $parent and $children
  2. Create an admin class for it
  3. In public function configureListFields(ListMapper $listMapper) use
    $listMapper->add('children', null, ['template' => 'App\Admin\CRUD\list_custom.html.twig']);

Expected results

Custom listing for desired field.

Actual results

Object of class Doctrine\ORM\PersistentCollection could not be converted to string

var/cache/dev/twig/94/94258473ddbf71159141a1387431b2f46a425ebb9548c1f00b79de01ac530fc6.php line 218

        echo twig_escape_filter($this->env, (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new RuntimeError('Variable "value" does not exist.', 31, $this->source); })()), "html", null, true);
VincentLanglet commented 4 years ago

What is the content of App\Admin\CRUD\list_custom.html.twig, because the error could be in this file. Children is a Collection and you may use it as a string.

kyeno commented 4 years ago

I literally stripped it down to static text, the error still persists:

{% extends '@SonataAdmin/CRUD/base_list_field.html.twig' %}

{% block field %}
    <div>
        Static text (for test)
    </div>
{% endblock %}
kyeno commented 4 years ago

I think I know where you're coming from; looking at the source of base_list_field.html.twig it indeed tries to access the object alone. What else would I extend?

kyeno commented 4 years ago

Deleting the whole extends line doesn't make the error disappear either. I also updated my stack to remove core-bundle and update twig-extensions to 1.4.1. Nada. :(

VincentLanglet commented 4 years ago

Could you provide a repo with the error ? It's hard to blind-debug for me.

If you remove the children field, no error ? If you remove the template option, no error ? Then if you use a custom template with nothing inside, you get an error ?

kyeno commented 4 years ago

Providing the actual repo would be impossible since it's a project I'm doing for someone. Making a special repo just with this error - I could try doing that tomorrow.

Custom, empty template - error persists. If I remove children field - no error. If I remove template option - no error.

wbloszyk commented 4 years ago

@kyeno Can you use this custom template instead @SonataAdmin/CRUD/base_list_field.html.twig?

<td>
    {% block field %}
        Parent template for test.
    {% endblock %}
</td>

This will test @SonataAdmin/CRUD/base_list_field.html.twig. You can also add __toString() method to children class or use `{{ dump() }} to debug it.

kyeno commented 4 years ago

@wbloszyk I tried, but I came to that literally anything declared as template option triggers this error. I can use 'template' => 'a' - boom. Only not having the template set or having 'template' => '' removes the error.

I added __toString() magic methods to both the Entity and it's EntityRepository for the sake of testing - no donut.

Maybe small part of my models could help you analyze?

So, here's the Post entity that's actually connected with SonataNewsBundle:

<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Sonata\NewsBundle\Entity\BasePost as BasePost;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

use Gedmo\Timestampable\Traits\TimestampableEntity;
use Gedmo\Blameable\Traits\BlameableEntity;
use Gedmo\IpTraceable\Traits\IpTraceableEntity;

use App\Entity\Traits\SEOTrait;

/**
 * News
 *
 * @ORM\Table(name="post")
 * @ORM\Entity(repositoryClass="App\Repository\PostRepository")
 */
class Post extends BasePost
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     *
     * @var int $id
     */
    protected $id;

    /**
     * HAS MANY: Child posts (self-referencing) for translations
     * @ORM\OneToMany(targetEntity="Post", mappedBy="parent")
     */
    protected $children;

    /**
     * HAS ONE: Parent post (self-referencing) for translations
     * @ORM\ManyToOne(targetEntity="Post", inversedBy="children")
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
     */
    protected $parent;

    /**
     * @ORM\Column(name="language", type="string", length=2, nullable=false)
     * @Assert\Choice(callback = {"App\Enumerator\LocaleEnumerator", "getLanguageChoiceKeys"})
     */
    protected $language = 'en';

    // Include SEO fields and trackable behaviours
    use SEOTrait;
    //use TimestampableEntity;    // NOTE: incompatible with NewsBundle's BasePost
    use BlameableEntity;
    use IpTraceableEntity;

    public function __construct()
    {
        parent::__construct();
        $this->children = new ArrayCollection();
    }

    public function __toString()
    {
        return ($this->getTitle()) ?: 'unnamed';
    }
    /**
     * Get id.
     *
     * @return int $id
     */
    public function getId()
    {
        return $this->id;
    }

    public function getLanguage(): ?string
    {
        return $this->language;
    }

    public function setLanguage(string $language): self
    {
        $this->language = $language;

        return $this;
    }

    /**
     * @return Collection|Post[]
     */
    public function getChildren(): Collection
    {
        return $this->children;
    }

    public function addChild(Post $child): self
    {
        if (!$this->children->contains($child)) {
            $this->children[] = $child;
            $child->setParent($this);
        }

        return $this;
    }

    public function removeChild(Post $child): self
    {
        if ($this->children->contains($child)) {
            $this->children->removeElement($child);
            // set the owning side to null (unless already changed)
            if ($child->getParent() === $this) {
                $child->setParent(null);
            }
        }

        return $this;
    }

    public function getParent(): ?self
    {
        return $this->parent;
    }

    public function setParent(?self $parent): self
    {
        $this->parent = $parent;

        return $this;
    }
}

Repository is empty, just has the __toString() magic method, so I won't be pasting it in.

Here are some important parts of sonata_news.yaml:

sonata_news:
    permalink_generator: sonata.news.permalink.collection
    db_driver:    'doctrine_orm'
    class:
        post:       App\Entity\Post
        comment:    App\Entity\Comment
        media:      App\Entity\Media
        user:       App\Entity\User
        tag:        App\Entity\Tag
        collection: App\Entity\Collection

    # override defaults
    admin:
        post:
            class:          App\Admin\PostAdmin

Here are potentially interesting parts of PostAdmin:

<?php
namespace App\Admin;

// SonataNewsBundle defaults we'll be overriding
use Sonata\NewsBundle\Admin\PostAdmin as AbstractAdmin;
//use Sonata\AdminBundle\Admin\AbstractAdmin;

// Sonata default
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper;

// SonataFormatterBundle and other field types we might want
use Sonata\FormatterBundle\Form\Type\FormatterType;
use Sonata\AdminBundle\Form\Type\ModelType;
use Sonata\AdminBundle\Form\Type\ModelListType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;

// Custom queries
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;

// Enumeration
use App\Enumerator\LocaleEnumerator;

// Traits
use App\Admin\Traits\SEOAdminTrait;
use App\Admin\Traits\TrackableAdminTrait;

class PostAdmin extends AbstractAdmin
{
    use SEOAdminTrait {

        SEOAdminTrait::configureFormFields as configureFormFieldsSEO;
    }

    use TrackableAdminTrait {

        TrackableAdminTrait::configureFormFields as configureFormFieldsTrackable;
        TrackableAdminTrait::configureDatagridFilters as configureDatagridFiltersTrackable;
    }

    protected function configureDefaultSortValues(array &$sortValues): void
    {
        $sortValues['_sort_order'] = 'DESC';
    }

    /**
     * Custom query to select only parent nodes; rule out all child nodes and render them within list
     *
     * @param ProxyQueryInterface $query
     * @return ProxyQueryInterface
     */
    protected function configureQuery(ProxyQueryInterface $query): ProxyQueryInterface
    {
        $query = parent::configureQuery($query);

        $query->andWhere(

            $query->expr()->isNull($query->getRootAliases()[0] . '.parent')
        );

        return $query;
    }
    /**
     * @param ListMapper $listMapper
     */
    protected function configureListFields(ListMapper $listMapper)
    {

         parent::configureListFields($listMapper);

         // custom stuff
         $listMapper
            ->add('language', 'choice', [

                'multiple'  => true,
                'label'     => 'Language',
                'choices'   => LocaleEnumerator::getLanguageChoices(),

                'editable'  => false
            ])

            // FIXME: Object of class Doctrine\ORM\PersistentCollection could not be converted to string
            //->add('children', 'array', [
            ->add('children', null, [

                'label'     => 'Translations',
                //'template'  => 'App/Admin/CRUD/list_child_posts.html.twig'  // NOTE: anything here breaks it
            ])

            ->add('_action', null, [

                'label'     => 'Actions',
                'actions'   => [

                    'edit'      => [],
                    'delete'    => []
                ]
            ])
         ;
    }
wbloszyk commented 4 years ago
public function __toString()
{
    //return ($this->getTitle()) ?: 'unnamed';
    return $this->getTitle() ?? 'unnamed';
}

What about admin extensions? If you haven't register extensions we can should be able to reproduce it in custom project.

Edit I think you should use @App/Admin/CRUD/list_child_posts.html.twig

->add('children', null, [
    'label'     => 'Translations',
    'template'  => '@App/Admin/CRUD/list_child_posts.html.twig'
])
VincentLanglet commented 4 years ago

The error is coming from class SonataAdminExtension, which is trying to render

@SonataAdmin/CRUD/base_list_field.html.twig

The call is made by the private method render, which is called by renderListElement. This method is looking for the template, thanks to the method getTemplate.

$templateName = $fieldDescription->getTemplate() ?: $defaultTemplate;

try {
    $template = $environment->load($templateName);
} catch (LoaderError $e) {
    @trigger_error(sprintf(
        'Relying on default template loading on field template loading exception is deprecated since 3.1'
        .' and will be removed in 4.0. A %s exception will be thrown instead',
        LoaderError::class
    ), E_USER_DEPRECATED);
    $template = $environment->load($defaultTemplate);

    if (null !== $this->logger) {
        $this->logger->warning(sprintf(
            'An error occured trying to load the template "%s" for the field "%s",'
            .' the default template "%s" was used instead.',
            $templateName,
            $fieldDescription->getFieldName(),
            $defaultTemplate
        ), ['exception' => $e]);
    }
}

return $template;

There is a fallback is your template is not found. You're just giving a wrong path.

'template' => 'App\Admin\CRUD\list_custom.html.twig'

If the directory are: templates/Admin/CRUD/list_custom.html.twig, I would use

'template' => 'Admin/CRUD/list_custom.html.twig'
kyeno commented 4 years ago

Hey! Thanks for your tips - but that's sadly not the case. I tried variety of path/prefix styling to that template and it simply doesn't work, keeps throwing the very same error. Even setting it to:

'template'  => '@SonataAdmin\CRUD\base_list_field.html.twig'

Throws the very same error.

kyeno commented 4 years ago

...and honestly I never heard of or used Admin Extensions before. I used Sonata for variety of projects running Symfony2, Symfony3 and now Symfony4.

VincentLanglet commented 4 years ago

It seems to work for me.

Look at renderListElement and the private method render in the vendor.

In the render method, replace

$content = $template->render($parameters);

By

try {
    $content = $template->render($parameters);
} catch (\Throwable $e) {
    dd($template, $parameters);
}

In the renderListElement, replace

$template = $this->getTemplate(
            $fieldDescription,
            // NEXT_MAJOR: Remove this line and use commented line below instead
            $fieldDescription->getAdmin()->getTemplate('base_list_field'),
            //$this->getTemplateRegistry($fieldDescription->getAdmin()->getCode())->getTemplate('base_list_field'),
            $environment
        );

By

$template = $this->getTemplate(
            $fieldDescription,
            // NEXT_MAJOR: Remove this line and use commented line below instead
            $fieldDescription->getAdmin()->getTemplate('base_list_field'),
            //$this->getTemplateRegistry($fieldDescription->getAdmin()->getCode())->getTemplate('base_list_field'),
            $environment
        );

dump($fieldDescription, $template);

Then go on the page. You'll see the template he's trying to use (it will be base_list_field) and you'll the field description related.

Now, you can go in getTemplate method, and change

try {
            $template = $environment->load($templateName);
        } catch (LoaderError $e) {
            @trigger_error(sprintf(
                'Relying on default template loading on field template loading exception is deprecated since 3.1'
                .' and will be removed in 4.0. A %s exception will be thrown instead',
                LoaderError::class
            ), E_USER_DEPRECATED);
            $template = $environment->load($defaultTemplate);

            if (null !== $this->logger) {
                $this->logger->warning(sprintf(
                    'An error occured trying to load the template "%s" for the field "%s",'
                    .' the default template "%s" was used instead.',
                    $templateName,
                    $fieldDescription->getFieldName(),
                    $defaultTemplate
                ), ['exception' => $e]);
            }
        }

By

try {
            $template = $environment->load($templateName);
        } catch (LoaderError $e) {
            dump($templateName);

            @trigger_error(sprintf(
                'Relying on default template loading on field template loading exception is deprecated since 3.1'
                .' and will be removed in 4.0. A %s exception will be thrown instead',
                LoaderError::class
            ), E_USER_DEPRECATED);
            $template = $environment->load($defaultTemplate);

            if (null !== $this->logger) {
                $this->logger->warning(sprintf(
                    'An error occured trying to load the template "%s" for the field "%s",'
                    .' the default template "%s" was used instead.',
                    $templateName,
                    $fieldDescription->getFieldName(),
                    $defaultTemplate
                ), ['exception' => $e]);
            }
        }

If the template name is dump, it means that he cannot find it.

VincentLanglet commented 4 years ago

You tried '@SonataAdmin\CRUD\base_list_field.html.twig'.

You can see in my example I use / and not \. Not sure if it's the reason twig cannot find the template.

Where is your custom template ?

kyeno commented 4 years ago

Honestly, first and foremost I'm trying to make it work with whatever custom template, even pre-setting one of the Sonata's CRUD ones. I'm experimenting with SonataAdminExtension class now. dumping in renderListElement doesn't change much, I still get the red HTTP500 error with stack trace. Dumping with die() stops on the very first list element which, of course, is not that one.

I'll try dumping to file in order to debug.

VincentLanglet commented 4 years ago

It works well when I try it. So I think my hypothesis is the right one, the template is not found and it use the default one.

Honestly, first and foremost I'm trying to make it work with whatever custom template, even pre-setting one of the Sonata's CRUD ones.

It doesn't matter what you try if you have a mistake in the way you wrote the path. You never answered to me. Where is your custom template @kyeno ?

'@SonataAdmin\CRUD\base_list_field.html.twig'

It obviously won't work if you use this template...

kyeno commented 4 years ago

Had to run off for a bit. @VincentLanglet Indeed I skipped answering, but you were right at the very end!

'template'  => 'Admin/CRUD/list_custom.html.twig'

did the trick. Amazing. Guess it's my "price to pay" for migration from Symfony3 to Symfony4.

Still the error it renders is at least strange. Maybe worth "enhancing" error catching/throwing logic here in general?

Thank you!

VincentLanglet commented 4 years ago

Still the error it renders is at least strange. Maybe worth "enhancing" error catching/throwing logic here in general?

It's a BC-break. You need to wait for 4.0 version. It's already implemented.