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

Error message missing file path #16

Closed
insionng opened this issue Jul 18, 2014 · 5 comments
Closed

Error message missing file path #16

insionng opened this issue Jul 18, 2014 · 5 comments
Labels

Comments

@insionng
Copy link

I have a lot of go-style template file,

However, the error information provided by missing pongo prompted for a file path.

When I have a lot of template files,

I find the error is very difficult,

Expect you to provide a modified version with a file path information as soon as possible.

This would be a great help.
Thank you.

@flosch
Copy link
Owner

flosch commented Jul 18, 2014

All pongo error messages should provide a proper information like line/col and filename. Can you please give concrete examples where it does not?

@insionng
Copy link
Author

panic: [Parse Error in <string> | Line 1 Col 12 (<Token Typ=String (5) Val='head' Line=1 Col=12>)] '}}' expected

goroutine 16 [running]:
runtime.panic(0x7a1b40, 0xc082001140)
    C:/Go/src/pkg/runtime/panic.c:279 +0x11f
github.com/flosch/pongo2.Must(0x0, 0x35c190, 0xc082001140, 0x35c190)
    E:/gopath/src/github.com/flosch/pongo2/pongo2.go:12 +0x56
github.com/macaron-contrib/pongo2.func·001(0xc082009a40, 0x19, 0x3608d8, 0xc082015200, 0x0, 0x0, 0x0, 0x0)
    E:/gopath/src/github.com/macaron-contrib/pongo2/pongo2.go:87 +0x2df
path/filepath.walk(0xc082009a40, 0x19, 0x3608d8, 0xc082015200, 0xc082055c08, 0x0, 0x0)
    C:/Go/src/pkg/path/filepath/path.go:343 +0x93
path/filepath.walk(0x868ed0, 0x9, 0x3608d8, 0xc082014a20, 0xc082055c08, 0x0, 0x0)
    C:/Go/src/pkg/path/filepath/path.go:368 +0x4fc
path/filepath.Walk(0x868ed0, 0x9, 0xc082055c08, 0x0, 0x0)
    C:/Go/src/pkg/path/filepath/path.go:390 +0xec
github.com/macaron-contrib/pongo2.compile(0x868ed0, 0x9, 0xc0820096e0, 0x2, 0x2, 0x833f30, 0x5, 0x101, 0x0, 0x0, ...)
    E:/gopath/src/github.com/macaron-contrib/pongo2/pongo2.go:93 +0xc9
github.com/macaron-contrib/pongo2.Pongoer(0xc082055ec8, 0x1, 0x1, 0x0, 0x0)
    E:/gopath/src/github.com/macaron-contrib/pongo2/pongo2.go:148 +0x18e
main.main()
    E:/gopath/src/flower/app.go:24 +0x1f6

goroutine 19 [finalizer wait]:
runtime.park(0x415a40, 0xa78cf8, 0xa76669)
    C:/Go/src/pkg/runtime/proc.c:1369 +0xac
runtime.parkunlock(0xa78cf8, 0xa76669)
    C:/Go/src/pkg/runtime/proc.c:1385 +0x42
runfinq()
    C:/Go/src/pkg/runtime/mgc0.c:2644 +0xdd
runtime.goexit()
    C:/Go/src/pkg/runtime/proc.c:1445

goroutine 37 [runnable]:
text/template/parse.lexText(0xc082028a00, 0x90bb40)
    C:/Go/src/pkg/text/template/parse/lex.go:228 +0x388
text/template/parse.(*lexer).run(0xc082028a00)
    C:/Go/src/pkg/text/template/parse/lex.go:198 +0x47
created by text/template/parse.lex
    C:/Go/src/pkg/text/template/parse/lex.go:191 +0x119

This is the error message data for me, but I can't see template error file path.

@flosch
Copy link
Owner

flosch commented Jul 18, 2014

The reason for that lies here:

https://github.com/macaron-contrib/pongo2/blob/master/pongo2.go#L87

There is no filename provided to pongo2, so it can't output any. If you're working on macaron-contrib, then it would be useful if you would use pongo2.FromFile instead of pongo2.FromString. pongo2 will then output proper error messages with filenames in it.

If you're not working on macaron-contrib, you want to file an issue in their issue tracker.

@flosch flosch added the invalid label Jul 18, 2014
@flosch flosch closed this as completed Jul 18, 2014
@insionng
Copy link
Author

Thank you very much for your tips. I've told Unknwon , this problem has been solved. The error message has been correctly the output file path.

panic: [Parse Error in templates\CreateNode.html | Line 1 Col 12 (<Token Typ=String (5) Val='head' Line=1 Col=12>)] '}}' expected

@flosch
Copy link
Owner

flosch commented Jul 18, 2014

You're welcome!

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

No branches or pull requests

2 participants