getMessage
getMessage is a common method name used in several programming languages to retrieve the textual description associated with an object, most often an exception or error object. It returns the detail message that explains what went wrong or what the object represents.
In Java, getMessage is defined by the Throwable class. Its signature is public String getMessage(). It returns
In PHP, getMessage is a method of the Exception class (and its subclasses). It returns a string
Other languages may expose similar functionality under different names. For instance, C# uses a Message property
Usage of getMessage typically occurs after catching an exception to log or display a descriptive error, or
See also: getLocalizedMessage in Java, exception handling, logging practices.