The one error type cooper-config throws for a
configuration problem: a document that does not load, a value the
conversion refuses, a secrets policy it refuses, a value require()
finds missing, and a read before anything was loaded.
A wrong argument (an unknown option, a path that is not a string) is
a TypeError instead: that is a bug in the calling code, not in the
configuration, and the two are caught for different reasons.
The CASC file being loaded, when the error came from a load.
formatted
formatted:string
What went wrong, without the "failed to load ..." preamble: cooper's
error formatted with its location and stage, or the conversion's own
refusal. message always contains it.
Fileoverview
The one error type
cooper-configthrows for a configuration problem: a document that does not load, a value the conversion refuses, a secrets policy it refuses, a valuerequire()finds missing, and a read before anything was loaded.A wrong argument (an unknown option, a path that is not a string) is a
TypeErrorinstead: that is a bug in the calling code, not in the configuration, and the two are caught for different reasons.