Skip to content
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

Wrap URI.parse() call in try ... catch #180

Merged
merged 1 commit into from Oct 7, 2019

Conversation

@sryze
Copy link
Contributor

sryze commented Oct 5, 2019

When URI.parse() encounters an invalid URL it can throw a URIError, but the error is never caught and it pops up in the user's face (issue #173). So this patch simply puts the parse call in a try ... catch statement.

I don't know if the URI library is supposed to throw an error in this case, it may be an issue with vscode-uri.

Steps to reproduce the error:

  1. Create a file named test.scss
  2. Paste:
.test {
    background: url('<%=invalid%>');
}
  1. Open the file in VS Code and observe an error notification:

error-popup

If you are wondering why I would be using an invalid URL - it's not really invalid, the CSS file produced by the SCSS compiler in my project is included inline into a JSP page, and the url() actually contains a JSP echo tag inside (<%=some expression%>). This used to work in VS Code 1.36 and earlier, but started to throw an error in newer releases.

@aeschli aeschli merged commit 5106f17 into microsoft:master Oct 7, 2019
6 checks passed
6 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla All CLA requirements met.
microsoft.vscode-css-languageservice Build #20191005.1 succeeded
Details
microsoft.vscode-css-languageservice (Job linux) Job linux succeeded
Details
microsoft.vscode-css-languageservice (Job mac) Job mac succeeded
Details
microsoft.vscode-css-languageservice (Job windows) Job windows succeeded
Details
@aeschli

This comment has been minimized.

Copy link
Contributor

aeschli commented Oct 7, 2019

Looks good, thanks @sryze !

@aeschli aeschli added this to the October 2019 milestone Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.