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 code and the requested locale.

Properties

code → String
The code that was not found.
final
hashCode → int
The hash code for this object.
no setterinherited
locale → String?
The requested locale, or null when none was given.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

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