MissingPropertyException class final
The error for a property read as required that no source has.
getRequiredProperty and getRequiredPropertyAs throw it instead of
returning null, so code that needs a value can read it in one line
and fail with a clear message ("Required key 'db.url' not found") when
it is missing.
try {
environment.getRequiredProperty('db.url');
} on MissingPropertyException catch (error) {
log.warning(error.key); // db.url
}
Spring (Java):
// Spring throws IllegalStateException
// ("Required key 'db.url' not found").
String url = environment.getRequiredProperty("db.url");
- Implemented types
Constructors
- MissingPropertyException(String key)
-
Creates the exception for the missing
key.
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