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

Feature request about riot.compile(url, callback) #2451

Closed
ShiMeiWo opened this issue Sep 26, 2017 · 2 comments
Closed

Feature request about riot.compile(url, callback) #2451

ShiMeiWo opened this issue Sep 26, 2017 · 2 comments

Comments

@ShiMeiWo
Copy link

@ShiMeiWo ShiMeiWo commented Sep 26, 2017

  1. Describe your issue:

Once trying compile tag file that not exists(e.g. riot.compile('not-exists.tag.html', onLoadTag) ), just we receive that GET not-exists.tag.html 404 (Not Found) on the console window. How about to throw a exception or to execute an error-callback when the compiler fails to load a tag file? It may be helpful to make 404 fallback page when we make SPA with routing library.

Thanks.

  1. Can you reproduce the issue?

http://plnkr.co/edit/l10fCA?p=info

in tags/content.tag.html:

      // I want to control the application when tag file is missing
      riot.compile('tags/' + pageID + '.tag.html', function(){
        tag.update()
      })
  1. On which browser/OS does the issue appear?
    Any.

  2. Which version of Riot does it affect?
    --

  3. How would you tag this issue?

  • Question
  • Bug
  • Discussion
  • Feature request
  • Tip
  • Enhancement
  • Performance
@GianlucaGuarini
Copy link
Member

@GianlucaGuarini GianlucaGuarini commented Oct 1, 2017

In riot@3.7.3 riot will throw errors in case files will be not found on the server via runtime compilation.

@ShiMeiWo
Copy link
Author

@ShiMeiWo ShiMeiWo commented Oct 3, 2017

I tried the below code and I got succeed to handle access error!

riot.compile.error = function(e) {
  //error-handling code
}
riot.compile('path/to/tagfile.tag', function(e) {
  // to change apprication mode...
})

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.