Skip to content
Permalink
Browse files

Improved thrown MissingElementException message

Currently, the exception message is just the file location.name ($file). Added some context.
  • Loading branch information...
JayPHP committed Dec 8, 2016
1 parent 77d0465 commit 5bb25cee2a5de3629f076cb6eba4d26bc212748f
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/View/View.php
@@ -505,7 +505,9 @@ public function element($name, array $data = [], array $options = [])
list ($plugin, $name) = pluginSplit($name, true);
$name = str_replace('/', DIRECTORY_SEPARATOR, $name);
$file = $plugin . 'Element' . DIRECTORY_SEPARATOR . $name . $this->_ext;
throw new MissingElementException($file);
throw new MissingElementException(
sprintf('Element file "%s" is missing', $file)
);
}
}

5 comments on commit 5bb25ce

@elboletaire

This comment has been minimized.

Copy link
Contributor

elboletaire replied Dec 15, 2016

Why is this done this way? Watching this I don't get why is there a $_messageTemplate var in MissingElementException.

@elboletaire

This comment has been minimized.

Copy link
Contributor

elboletaire replied Dec 15, 2016

Ok, taking a look to the Exception class I see that maybe just specifying [$file] instead of $file would be enough, am I right?

@ADmad

This comment has been minimized.

Copy link
Member

ADmad replied Dec 15, 2016

This change was a mistake and was reverted.

@elboletaire

This comment has been minimized.

Copy link
Contributor

elboletaire replied Dec 15, 2016

Uoops.. sorry 😅

@JayPHP

This comment has been minimized.

Copy link
Member Author

JayPHP replied Dec 19, 2016

My bad :P

Please sign in to comment.
You can’t perform that action at this time.