- added custom error function which is able to throw exceptions