Catch exceptions in before class

Can be merged
#187 - first part of task