Skip to content

Instantly share code, notes, and snippets.

@stevekrouse
Created May 21, 2019 22:53
Show Gist options
  • Select an option

  • Save stevekrouse/d0e0443f2269933ac4e0fe7321876a78 to your computer and use it in GitHub Desktop.

Select an option

Save stevekrouse/d0e0443f2269933ac4e0fe7321876a78 to your computer and use it in GitHub Desktop.
if (error.url === "") {
var emptyURLTypes = ["setBackdropURL('')", 'setBackdropURL("")', 'url: ""', "url: ''"]
var emptyURLType = emptyURLTypes.find(t => code.includes(t))
if (emptyURLType) {
app.error = {message: "You forgot to include an image or background URL.", lineno: code.substring(0, code.indexOf(emptyURLType)).split('\n').length}
} else {
// We can't figure out the lineno if it's set to an empty string variable
// https://woofjs.com/create#image-url-issue
app.error = {message: "You forgot to include an image or background URL.", lineno: null}
}
} else {
app.error = {message: "Your image URL (" + error.url +") is misspelled or not correct.", lineno: code.substring(0, code.indexOf(error.url)).split('\n').length}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment