Exception: Stupidedi::Exceptions::MissingGrammarError
- Inherits:
-
StupidediError
- Object
- StandardError
- StupidediError
- Stupidedi::Exceptions::MissingGrammarError
- Defined in:
- lib/stupidedi/exceptions/missing_grammar_error.rb
Overview
Raised when application code reaches for a grammar that tediparse does
not ship. tediparse is the parser/writer engine only; transaction-set
grammars, code lists, and implementation guides are not bundled (they
are X12 IP). Users must register their own grammar against
Stupidedi::Config before parsing.
Three places raise this:
-
Stupidedi::Interchanges.const_missing,Stupidedi::Versions.const_missing, andStupidedi::TransactionSets.const_missingraise it when application code references a per-era constant by name (e.g.Stupidedi::Versions::FiftyTen). -
The three envelope parser states (+InterchangeState+,
FunctionalGroupState,TransactionSetState) surface this message as thereasononInvalidSegmentValwhen the relevant config sub-registry is empty. The parser itself does not raise — it produces aFailureState— but the message is the same so users see one consistent UX whether they hit a bareconst_missingor a parse failure.
Constant Summary collapse
- DEFAULT_MESSAGE =
"tediparse does not ship with X12 grammars or transaction-set " \ "definitions. Register your own grammar against Stupidedi::Config " \ "before parsing — see the README for an authoring example."
Instance Method Summary collapse
-
#initialize(context = nil) ⇒ MissingGrammarError
constructor
A new instance of MissingGrammarError.
Constructor Details
#initialize(context = nil) ⇒ MissingGrammarError
Returns a new instance of MissingGrammarError.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/stupidedi/exceptions/missing_grammar_error.rb', line 38 def initialize(context = nil) = if context "#{DEFAULT_MESSAGE} (while resolving #{context})" else DEFAULT_MESSAGE end super() end |