They seem to do the same thing to me.
assert 1 > 2, "error"
raise StandardError ("error")
raise Exception ("exception")
Also, what's the difference between an exception and error?
If the assert fails it throws an exception of type AssertionError. If you turn on optimizations no asserts will throw.
StandardError is derived from Exception, so it is an exception.
Asserts are more for debugging: they're conditions that must hold or else there is a bug in the code. For example, suppose you have made a list class. Then it would be okay to assert that the size of the list is a non-negative integer.
Raise is used for exceptions: these are more for problems that may be caught and dealt with appropriately. Taking the list example again, suppose you initialize the list to have a maximum of 4 elements, then add 5 elements: the list should at that point throw an exception.
As a rule of thumb: assertions are for internal problems, exceptions are for external problems.