You can create a subclass of an exception to make it more descriptive, but how should you set the default 'message'?
class MyError < StandardError
# default message = "You've triggered a MyError"
end
begin
raise MyError, "A custom message"
rescue Exception => e
p e.message
end
begin
raise MyError
raise Exception => e
p e.message
end
The first should output 'A custom message'
The second should output 'You've triggered a MyError'
Any suggestions as to best practice?