Module: Longfellow::Errors
- Defined in:
- lib/longfellow/errors.rb
Overview
Maps the C ABI return enums to symbols and raises on non-success. The arrays below are ordered to match the enum declarations in mdoc_zk.h exactly.
Constant Summary collapse
- PROVER_CODES =
%i[ success null_input invalid_input circuit_parsing_failure hash_parsing_failure witness_creation_failure general_failure memory_allocation_failure invalid_zk_spec_version root_decoding_failure documents_missing document_0_missing doctype_missing issuer_signed_missing issuer_auth_missing mso_missing nsig_missing namespaces_missing device_signed_missing device_auth_missing device_signature_missing device_key_missing mso_decoding_failure validity_info_missing device_key_info_missing attribute_decode_failure attribute_ei_missing attribute_ev_missing attribute_did_missing signature_failure device_signature_failure attribute_not_found attribute_too_long tagged_mso_too_big version_not_supported attribute_random_missing ].freeze
- VERIFIER_CODES =
%i[ success circuit_parsing_failure proof_too_small hash_parsing_failure signature_parsing_failure general_failure null_input invalid_input arguments_too_small attribute_number_mismatch invalid_zk_spec_version invalid_cbor ].freeze
- CIRCUIT_CODES =
%i[ success null_input zlib_failure general_failure invalid_zk_spec_version ].freeze
Class Method Summary collapse
- .check!(code, table, klass, context) ⇒ Object
- .check_circuit!(code) ⇒ Object
- .check_prover!(code) ⇒ Object
- .check_verifier!(code) ⇒ Object
Class Method Details
.check!(code, table, klass, context) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/longfellow/errors.rb', line 71 def check!(code, table, klass, context) return if code.zero? symbol = table[code] || :unknown raise klass.new(symbol, code, context) end |
.check_circuit!(code) ⇒ Object
67 68 69 |
# File 'lib/longfellow/errors.rb', line 67 def check_circuit!(code) check!(code, CIRCUIT_CODES, CircuitGenerationError, "generate_circuit") end |
.check_prover!(code) ⇒ Object
59 60 61 |
# File 'lib/longfellow/errors.rb', line 59 def check_prover!(code) check!(code, PROVER_CODES, ProverError, "run_mdoc_prover") end |
.check_verifier!(code) ⇒ Object
63 64 65 |
# File 'lib/longfellow/errors.rb', line 63 def check_verifier!(code) check!(code, VERIFIER_CODES, VerifierError, "run_mdoc_verifier") end |