Skip to content

InvalidResourceException file name #14762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

InvalidResourceException file name #14762

wants to merge 3 commits into from

Conversation

DancZer
Copy link
Contributor

@DancZer DancZer commented May 27, 2015

Added filen ame to the InvalidResourceException,

Added filen ame to the InvalidResourceException,
@@ -148,7 +148,7 @@ private function parseFile($file)
$source = str_replace('http://www.w3.org/2001/xml.xsd', $location, $source);

if (!@$dom->schemaValidateSource($source)) {
throw new InvalidResourceException(implode("\n", $this->getXmlErrors($internalErrors)));
throw new InvalidResourceException("File:$file\n".implode("\n", $this->getXmlErrors($internalErrors)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's be more verbose and say something like The "file.xlf" is not a valid resource.

Also, our coding standard favours single quotes, and sprintf should be used to create an exception message:

throw new InvalidResourceException(sprintf('The "%s" is not a valid resource: ', $file, implode("\n", $this->getXmlErrors($internalErrors))));

Refactored InvalidResourceException message.
@@ -148,7 +148,7 @@ private function parseFile($file)
$source = str_replace('http://www.w3.org/2001/xml.xsd', $location, $source);

if (!@$dom->schemaValidateSource($source)) {
throw new InvalidResourceException(implode("\n", $this->getXmlErrors($internalErrors)));
throw new InvalidResourceException(sprintf('The "%s" is not a valid resource: ', $file, implode("\n", $this->getXmlErrors($internalErrors))));
Copy link
Contributor

Choose a reason for hiding this comment

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

The "my_file.xml" is not a valid resource, This sounds a bit weird. What if you format it like this?

'Invalid resource provided: "%s"; Errors: %s', note that you forgot the second %s in your commit.

@Tobion
Copy link
Contributor

Tobion commented May 28, 2015

👍 should be merged in 2.3

@Tobion Tobion added the Ready label May 28, 2015
@fabpot
Copy link
Member

fabpot commented May 28, 2015

Thank you @DancZer.

fabpot added a commit that referenced this pull request May 28, 2015
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #14762).

Discussion
----------

InvalidResourceException file name

Added filen ame to the InvalidResourceException,

Commits
-------

2e04e23 InvalidResourceException file name
@fabpot fabpot closed this May 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy