gittup/tup — pull request #117 by Rendaw (2013-05-21 14:11:40+00:00)
Title: Simplified error messages

I removed low information error messages and excess stack traces. I think it's a lot clearer now. I tested with an array of error states, but it probably wasn't comprehensive.

I also did some stack management cleanup since the error messages stay on the stack longer. I notice you don't use asserts, but I've found them fairly effective for checking stack height invariants, especially since it can be hard to check externally if it only leaks. What's your policy on that?

No directory suffix indicates a test with a parse error
b indicates a execution error
c indicates an internal error

2 is no indirection
3 is 1 file indirection
4 is Tuprule
5 is Tuprule and 1 file indirection
6 is 2 file indirections

Before
```
==================================================== ./2/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.152s] Reading in new environment variables...
[ tup ] [0.153s] Parsing Tupfiles...
* 1) [0.003s] .
tup error: Failed to open Tupfile.lua:
[string "Tupfile.lua"]:1: '=' expected near '3'
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/2b ~/Temp/por
==================================================== ./2b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.128s] Reading in new environment variables...
[ tup ] [0.128s] Parsing Tupfiles...
* 1) [0.006s] .
tup error: Failed to execute Tupfile.lua:
[string "Tupfile.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/3 ~/Temp/por
==================================================== ./3/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.117s] Reading in new environment variables...
[ tup ] [0.117s] Parsing Tupfiles...
* 1) [0.003s] .
tup error: Failed to open b.lua:
[string "b.lua"]:1: '=' expected near '3'
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tupfile.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/3b ~/Temp/por
==================================================== ./3b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.114s] Reading in new environment variables...
[ tup ] [0.114s] Parsing Tupfiles...
* 1) [0.006s] .
tup error: Failed to execute b.lua:
[string "b.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tupfile.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/3c ~/Temp/por
==================================================== ./3c/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.140s] Reading in new environment variables...
[ tup ] [0.140s] Parsing Tupfiles...
* 1) [0.004s] .
tup error: Unable to find tup entry for file 'b.lua'
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tupfile.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/4 ~/Temp/por
==================================================== ./4/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.119s] Reading in new environment variables...
[ tup ] [0.119s] Parsing Tupfiles...
* 1) [0.005s] .
tup error: Failed to open Tuprules.lua:
[string "Tuprules.lua"]:1: '=' expected near '3'
tup error: Failed to parse included file 'Tuprules.lua'
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/4b ~/Temp/por
==================================================== ./4b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.132s] Reading in new environment variables...
[ tup ] [0.133s] Parsing Tupfiles...
* 1) [0.003s] .
tup error: Failed to execute Tuprules.lua:
[string "Tuprules.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "Tuprules.lua"]:1: in main chunk
tup error: Failed to parse included file 'Tuprules.lua'
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/5 ~/Temp/por
==================================================== ./5/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.125s] Reading in new environment variables...
[ tup ] [0.125s] Parsing Tupfiles...
* 1) [0.003s] .
tup error: Failed to open b.lua:
[string "b.lua"]:1: '=' expected near '3'
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tuprules.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tuprules.lua"]:1: in main chunk
tup error: Failed to parse included file 'Tuprules.lua'
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/5b ~/Temp/por
==================================================== ./5b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.138s] Reading in new environment variables...
[ tup ] [0.138s] Parsing Tupfiles...
* 1) [0.004s] .
tup error: Failed to execute b.lua:
[string "b.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tuprules.lua"]:1: in main chunk
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tuprules.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tuprules.lua"]:1: in main chunk
tup error: Failed to parse included file 'Tuprules.lua'
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/5c ~/Temp/por
==================================================== ./5c/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.130s] Reading in new environment variables...
[ tup ] [0.130s] Parsing Tupfiles...
* 1) [0.006s] .
tup error: Unable to find tup entry for file 'b.lua'
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tuprules.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tuprules.lua"]:1: in main chunk
tup error: Failed to parse included file 'Tuprules.lua'
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/6 ~/Temp/por
==================================================== ./6/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.131s] Reading in new environment variables...
[ tup ] [0.132s] Parsing Tupfiles...
* 1) [0.004s] .
tup error: Failed to open c.lua:
[string "c.lua"]:1: '=' expected near '3'
tup error: Failed to parse included file 'c.lua'
tup error: Failed to execute b.lua:
Failed to include file "c.lua".
stack traceback:
[C]: in function 'include'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tupfile.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/6b ~/Temp/por
==================================================== ./6b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.114s] Reading in new environment variables...
[ tup ] [0.114s] Parsing Tupfiles...
* 1) [0.004s] .
tup error: Failed to execute c.lua:
[string "c.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "c.lua"]:1: in main chunk
[C]: in function 'include'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
tup error: Failed to parse included file 'c.lua'
tup error: Failed to execute b.lua:
Failed to include file "c.lua".
stack traceback:
[C]: in function 'include'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tupfile.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/6c ~/Temp/por
==================================================== ./6c/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.112s] Reading in new environment variables...
[ tup ] [0.112s] Parsing Tupfiles...
* 1) [0.004s] .
tup error: Unable to find tup entry for file 'c.lua'
tup error: Failed to parse included file 'c.lua'
tup error: Failed to execute b.lua:
Failed to include file "c.lua".
stack traceback:
[C]: in function 'include'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
tup error: Failed to parse included file 'b.lua'
tup error: Failed to execute Tupfile.lua:
Failed to include file "b.lua".
stack traceback:
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.

```

After
```
==================================================== ./2/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.146s] Reading in new environment variables...
[ tup ] [0.146s] Parsing Tupfiles...
* 1) [0.003s] .
tup error [string "Tupfile.lua"]:1: '=' expected near '3'
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/2b ~/Temp/por
==================================================== ./2b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.144s] Reading in new environment variables...
[ tup ] [0.145s] Parsing Tupfiles...
* 1) [0.005s] .
[string "Tupfile.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/3 ~/Temp/por
==================================================== ./3/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.128s] Reading in new environment variables...
[ tup ] [0.128s] Parsing Tupfiles...
* 1) [0.004s] .
tup error [string "b.lua"]:1: '=' expected near '3'
stack traceback:
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/3b ~/Temp/por
==================================================== ./3b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.128s] Reading in new environment variables...
[ tup ] [0.129s] Parsing Tupfiles...
* 1) [0.004s] .
[string "b.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/3c ~/Temp/por
==================================================== ./3c/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.163s] Reading in new environment variables...
[ tup ] [0.164s] Parsing Tupfiles...
* 1) [0.004s] .
tup error: Unable to find tup entry for file 'b.lua'
tup error [string "Tupfile.lua"]:1: Failed to include file 'b.lua'.
stack traceback:
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/4 ~/Temp/por
==================================================== ./4/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.135s] Reading in new environment variables...
[ tup ] [0.135s] Parsing Tupfiles...
* 1) [0.003s] .
tup error [string "Tuprules.lua"]:1: '=' expected near '3'
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/4b ~/Temp/por
==================================================== ./4b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.107s] Reading in new environment variables...
[ tup ] [0.107s] Parsing Tupfiles...
* 1) [0.004s] .
[string "Tuprules.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "Tuprules.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/5 ~/Temp/por
==================================================== ./5/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.123s] Reading in new environment variables...
[ tup ] [0.123s] Parsing Tupfiles...
* 1) [0.003s] .
tup error [string "b.lua"]:1: '=' expected near '3'
stack traceback:
[C]: in function 'include'
[string "Tuprules.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/5b ~/Temp/por
==================================================== ./5b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.142s] Reading in new environment variables...
[ tup ] [0.142s] Parsing Tupfiles...
* 1) [0.004s] .
[string "b.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tuprules.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/5c ~/Temp/por
==================================================== ./5c/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.142s] Reading in new environment variables...
[ tup ] [0.142s] Parsing Tupfiles...
* 1) [0.004s] .
tup error: Unable to find tup entry for file 'b.lua'
tup error [string "Tuprules.lua"]:1: Failed to include file 'b.lua'.
stack traceback:
[C]: in function 'include'
[string "Tuprules.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/6 ~/Temp/por
==================================================== ./6/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.112s] Reading in new environment variables...
[ tup ] [0.112s] Parsing Tupfiles...
* 1) [0.004s] .
tup error [string "c.lua"]:1: '=' expected near '3'
stack traceback:
[C]: in function 'include'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/6b ~/Temp/por
==================================================== ./6b/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.125s] Reading in new environment variables...
[ tup ] [0.125s] Parsing Tupfiles...
* 1) [0.004s] .
[string "c.lua"]:1: Test user error
stack traceback:
[C]: in function 'error'
[string "c.lua"]:1: in main chunk
[C]: in function 'include'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.
~/Temp/por
~/Temp/por/6c ~/Temp/por
==================================================== ./6c/ ============
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.121s] Reading in new environment variables...
[ tup ] [0.121s] Parsing Tupfiles...
* 1) [0.006s] .
tup error: Unable to find tup entry for file 'c.lua'
tup error [string "b.lua"]:1: Failed to include file 'c.lua'.
stack traceback:
[C]: in function 'include'
[string "b.lua"]:1: in main chunk
[C]: in function 'include'
[string "Tupfile.lua"]:1: in main chunk
[ ] 100%
*** tup: 1 job failed.

```