Fixed timeout that happened if an error occurs

When an error occurred it will just log the error but not return anything. FIxed that by just returning the error.
Merge pull request #5 from martinheidegger/patch-3

Fixed timeout that happened if an error occurs