Empty link's error message

6 years ago

roman.hocke
Member | 3
+
0
-

When I use

<a n:href="">

in a template (by mistake), Nette (2.2-dev) produces

<a href="error: Destination must be non-empty string.">

and doesn't show this error anywhere else. I would expect to see this error in Laděnka or somewhere else than in “href” attribute. I think my debugger is turned on in application's bootstrap.php:

$configurator->setDebugMode(TRUE);

6 years ago

jiri.pudil
Member | 861
+
0
-

You can force the presenter to throw an exception:

$presenter->invalidLinkMode = $presenter::INVALID_LINK_EXCEPTION;

6 years ago

Majkl578
Moderator | 1379
+
+1
-

You can also use CSS to visually highlight these links:

a[href^="error:"] {
    background: #f00;
    color: #fff;
}

JSFiddle

6 years ago

roman.hocke
Member | 3
+
0
-

@jiri.pudil: Thanks, this is useful, I will go examine other Presenter's options.

@Majkl: Thanks for a nice trick! But I wanted to point out that when any part of the framework produces an error, I would expect to see it in it's debugger (or log).

Last edited by roman.hocke (2014-01-19 16:06)