Raising and checking for an exception in case of invalid hexa strings