error handling inside the library