Better error handling in catalog directive

Thanks @gjn for catching the regressions I introduce.