throw on error

this adds basic error handling, throwing on the first error seen