Wrap errors in hook-fn