bungle/lua-resty-template

模版错误,较难排错

onlonely opened this issue · 2 comments

错误输出,全部,是如下样子,
很难找模版那里错误了.
请问本来这样,还是要其他方式排错呢

2016/02/03 13:36:40 [error] 25868#0: *1 lua entry thread aborted: runtime error: [string "context=... or {}..."]:101: attempt to index a nil value
stack traceback:
coroutine 0:
[string "context=... or {}..."]: in main chunk

If I understand correctly, you have something like this in your code:

{{nilvalue.something}}

This will give similar error you got. I know it may be hard to spot where the error is. Unfortunately it is not very easy to have it nicely reported. Any ideas would be great! The ideas that I have been thinking have performance or other issues.

Do you have the template you are trying to debug?

One thing you can do is:

print(template.parse(yourtemplate))

Then look at line 101.

明白了,谢谢