Define an initialize method, which takes the message as an argument with a default value. Then call StandardError‘s initialize method with that message (using super).
class MyError < StandardError
def initialize(msg = "You've triggered a MyError")
super(msg)
end
end