Replaced use of exceptions with golang style error handling