Throw new Errors rather than strings
Created by: davemevans
Whilst debugging some TTML streams I noticed that the parser logged any exceptions as undefined
. Turns out this is because the parser throws strings and logging code was looking for e.message
of an Error object which is obviously undefined if you throw a string. Fix was to change all string throws to new Error throws.
Throwing strings seems pretty bad form - Errors allow for stack tracing etc - so I changed all the other instances for good measure.