Added error handling logic and unit tests for the new getTotalBlocks … …
…method Auditors: @NejcZdovc