better implementation of exception resolver