NoSuchMessageException class final
Thrown when a message code is not found and no default message was given.
It usually means a translation is missing from a messages*.properties
file. Spring Boot's spring.messages.use-code-as-default-message=true
returns the code instead of throwing.
try {
source.getMessage('unknown');
} on NoSuchMessageException catch (e) {
log.warning(e.code); // unknown
}
Spring (Java):
try {
source.getMessage("unknown", null, locale);
} catch (NoSuchMessageException e) { ... }
- Implemented types
Constructors
- NoSuchMessageException(String code, [String? locale])
-
Creates the error for
codeand the requestedlocale.
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited