change error handling as a lib