Skip to content

Commit

Permalink
Improved thrown MissingElementException message
Browse files Browse the repository at this point in the history
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 5bb25ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/View/View.php
Expand Up @@ -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)
);
}
}

Expand Down

5 comments on commit 5bb25ce

@elboletaire
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@elboletaire
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

@ADmad ADmad commented on 5bb25ce Dec 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was a mistake and was reverted.

@elboletaire
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uoops.. sorry 😅

@JayPHP
Copy link
Member Author

@JayPHP JayPHP commented on 5bb25ce Dec 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad :P

Please sign in to comment.