Comments (10)
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.
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.
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.
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.
You mean the specific line? Good idea, will add it.
from pongo2.
Yeah that would be useful.
from pongo2.
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.
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.
Thanks @flosch, this works nicely!
from pongo2.
Glad to hear.
from pongo2.
Related Issues (20)
- Cannot using template.Fromfile HOT 1
- Context key invalid HOT 1
- How to convert golang array to javascript array HOT 1
- Why this is no document about how to use it ?? HOT 8
- Struct field names in templates / contexts
- Data race in `pongo2.FromFile()` method HOT 5
- Potential security issue HOT 3
- date filter does not work as expected HOT 4
- Array in yml file as context is not supported
- Macro that invokes other macros does not work when imported HOT 1
- Not compatible with GCCGO 13.0.0 HOT 1
- How can pongo2 does not escape chars which except TokenSymbols?
- Bug: random order for `for` loop. HOT 2
- Include statement doesn't work inside for loop
- Returning only a partial block
- Potential BC break on master (missing var comparison)
- BC break between v4 and v6 (string/num adding/concatenating)
- question about split filter on new line
- need strings function HOT 1
- What tags deos pongo uses of declared structs struct?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pongo2.