ITDP / the-online-brt-planning-guide

Online collaborative version of the BRT Planning Guide
https://brtguide.itdp.org
Other
6 stars 20 forks source link

Gen: transform fails on empty hierarchy elements, and other transform errors #1

Closed jonasmalacofilho closed 8 years ago

jonasmalacofilho commented 8 years ago

\subsection{a}\section{b} fails with an invalid field access for pos.

The transform phase should handle some empty hierarchy elements, even if not all of them.

Regardless of it being forbidden (say, for chapters) or not, errors should be graceful and informative, and should generally not require the use of the debug mode (setting DEBUG=1 in the environment).

@lehonma , can you take some time to improve error handling there?


commit: ae1de9e
target: js
error: TypeError: Cannot read property 'pos' of null
call stack:
Called from transform_Transform.hierarchy (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5235)
Called from transform_Transform.vertical (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5311)
Called from transform_Transform.consume (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5270)
Called from transform_Transform.hierarchy (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5225)
Called from transform_Transform.vertical (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5309)
Called from transform_Transform.consume (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5270)
Called from transform_Transform.hierarchy (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5225)
Called from transform_Transform.vertical (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5307)
Called from transform_Transform.vertical (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5376)
Called from transform_Transform.consume (/home/jonas/Code/brtpg/generator/bin/obrt.js line 5270)