Helper module for handling errors