Add error handling in getSha