Check for different errors

Not pretty yet, will have to tweak a bit.