generalize this to support other warning types