ruby: fix leaking C++ exceptions in create_opaque and create_null

If one attempted to create a type whose name is already registered,
the corresponding C++ exception would not be caught, causing the
program to terminate