added custom errors
finished error type refactor