Replaced "throw <string message>" statements with call to error function.
Merge branch 'tangelo-error'

Closes #228.