So, why not using that COMMENT ON message to raise when that constraint gets violated ?
A GUC like Constraint_Exception_Returns_MessageOn = {Never | Always | If_Exists}
with its default value set to Never, so it runs like today, but if changed to If_Exists it will try to
get that message or always, to show that COMMENT ON, even empty.
alter table b add constraint fk_b_a foreign key(ID) references a(ID); comment on constraint fk_b_a on b is 'There is a problem on Foreign Key on Table B related to Table A';