Raised when a feature is not implemented on the current platform. For example, methods depending on the fsync or fork system calls may raise this exception if the underlying operating system or Ruby runtime does not support them.
Note that if fork raises a NotImplementedError, then respond_to?(:fork) returns false.
class Foo
def self.bar
raise NotImplementedError, "You must define #resolve in #{self.class}"
rescue => e
puts e.message
end
end
# IRB
irb(main):015:0> Foo.bar
(irb):10:in `bar': You must define #resolve in Class (NotImplementedError)
from (irb):15:in `<main>'
from /Users/hery/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.6.4/exe/irb:9:in `<top (required)>'
from /Users/hery/.asdf/installs/ruby/3.2.2/bin/irb:25:in `load'
from /Users/hery/.asdf/installs/ruby/3.2.2/bin/irb:25:in `<main>'
This error is not appropriate for method not implemented.
https://ruby-doc.org/3.2.2/NotImplementedError.html
This error is not rescued by this syntax as its ancestor is not
StandardError
butScriptError