GithubHelp home page GithubHelp logo

Comments (10)

ahall avatar ahall commented on May 22, 2024

This is exactly what I was going to ask you about :). So we dont have to parse err.Message() and rely on the format of it.

from pongo2.

flosch avatar flosch commented on May 22, 2024

Ah okay, I thought your main concern was about a nice HTML error page.

Currently, there's only a string returned by the Execute*() methods which can easily be parsed (which is done on the playground, because the current syntax is something like [Line X Col Y] ABC with ABC being the error message). It's a bit inconvinient though so Instead of parsing this string, it will be possible to access the single details in the future. It already was on my TODO (in mind) as I developed the playground, but I somehow forgot about it. Thanks for making me remember.

from pongo2.

ahall avatar ahall commented on May 22, 2024

Yeah first idea I had was the HTML error page, but after you explained to me that it could be done I started having a look at it. Then realised you must be parsing err.Message() on the playground and I was about to ask you if you could implement an error object like you described here, but you were quicker than me :).

from pongo2.

ahall avatar ahall commented on May 22, 2024

Perhaps add the raw contents of the template to the error object? So we don't have to re-parse the file to generate a nice error page?

from pongo2.

flosch avatar flosch commented on May 22, 2024

You mean the specific line? Good idea, will add it.

from pongo2.

ahall avatar ahall commented on May 22, 2024

Yeah that would be useful.

from pongo2.

flosch avatar flosch commented on May 22, 2024

This change and #49 are already live and being used by the pongo2 playground: https://www.florian-schlachter.de/pongo2/

More information about the new error type: https://godoc.org/github.com/flosch/pongo2#Error

from pongo2.

flosch avatar flosch commented on May 22, 2024

Does this work like you expected it @ahall? Please let me know. I'm planning to release a RC for pongo2 v2 in the next few days/weeks, so thorough testing of the new features is highly appreciated.

from pongo2.

ahall avatar ahall commented on May 22, 2024

Thanks @flosch, this works nicely!

from pongo2.

flosch avatar flosch commented on May 22, 2024

Glad to hear.

from pongo2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.