A Rubyist's Walk Along the C-side (Part 8): Exceptions
31-Mar-2022 1674
In the previous article, you saw TypedData objects, a type unique to the Ruby C API. In this article, we’ll look at how to raise errors and rescue from errors.Raising errors You’ve already seen one way to raise errors in part 4. The Check_Type function guards that a variable is of a particular Ruby type and will raise a TypeError otherwise.The Ruby C API provides builtin errors as global variables. The builtin errors are prefixed with rb_e (e.g. rb_eRuntimeError for the RuntimeError exception). This was covered in more detail in part 4.
A Rubyist's Walk Along the C-side (Part 8): Exceptions #ruby #rubydeveloper #rubyonrails #Rubyist's #Along #C-side #(Part #Exceptions https://rubyonrails.ba/link/a-rubyist-s-walk-along-the-c-side-part-8-exceptions