Class ConfigParseException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.mchange.v2.cfg.ConfigParseException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ConfigVetoedException,OwnLogCarryingMissingFileException
public class ConfigParseException extends java.lang.ExceptionA failure to parse configuration, carrying the report of that failure with it.Whoever throws one of these owes it a complete account of what went wrong. That is the whole point of the class, and it is an obligation rather than a convenience, because nobody logs anything on its behalf: a caller that catches a
ConfigParseExceptiondrainsgetDelayedLogItems()and does no more. Throw one carrying an empty list and the failure passes in total silence.The reason the items have to travel on the exception is that there is no other way out. A
PropertiesConfigSourcereports through thePropertiesConfigSource.Parseit returns, and a Parse is only ever constructed on the success path — so everything a source accumulated before it threw is discarded at the throw. Sources cannot simply log instead: they run while MLog is still reading its own configuration, which is whyDelayedLogItemexists at all.So the rule for an implementor is: before throwing, put into the list every item you would have returned on the Parse, plus an item describing the failure itself. Pass the list you have been accumulating into; it is copied, not retained.
-
-
Constructor Summary
Constructors Constructor Description ConfigParseException(java.lang.String msg, java.lang.Throwable cause, java.util.List<DelayedLogItem> delayedLogItems)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<DelayedLogItem>getDelayedLogItems()The report this exception carries.
-
-
-
Constructor Detail
-
ConfigParseException
public ConfigParseException(java.lang.String msg, java.lang.Throwable cause, java.util.List<DelayedLogItem> delayedLogItems)
-
-
Method Detail
-
getDelayedLogItems
public java.util.List<DelayedLogItem> getDelayedLogItems()
The report this exception carries. Never null.A caller that swallows this exception must drain this list, or the account the thrower prepared is never made and the failure goes unmentioned.
-
-