Add checkType that takes an error code