API changes; exception handling

This modifies the publically exposed API of webapp to a new format that is
hopefully easier to integrate into other applications. I also fixed two issues
that I discovered during testing, both relating to the sourcePath option.