Exception: Tapyrus::ScriptError
- Inherits:
-
Exception
- Object
- Exception
- Tapyrus::ScriptError
- Defined in:
- lib/tapyrus/script/script_error.rb
Overview
tapyrus script error
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#extra_msg ⇒ Object
Returns the value of attribute extra_msg.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, extra_msg = "") ⇒ ScriptError
constructor
A new instance of ScriptError.
- #to_s ⇒ Object
Constructor Details
#initialize(code, extra_msg = "") ⇒ ScriptError
Returns a new instance of ScriptError.
7 8 9 10 11 |
# File 'lib/tapyrus/script/script_error.rb', line 7 def initialize(code, extra_msg = "") raise "invalid error code." unless ERRCODES_MAP[code] @code = code @extra_msg = extra_msg end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/tapyrus/script/script_error.rb', line 4 def code @code end |
#extra_msg ⇒ Object
Returns the value of attribute extra_msg.
5 6 7 |
# File 'lib/tapyrus/script/script_error.rb', line 5 def extra_msg @extra_msg end |
Class Method Details
.name_to_code(name) ⇒ Object
98 99 100 |
# File 'lib/tapyrus/script/script_error.rb', line 98 def self.name_to_code(name) NAME_MAP[name] end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/tapyrus/script/script_error.rb', line 13 def to_s case code when SCRIPT_ERR_OK "No error" when SCRIPT_ERR_EVAL_FALSE "Script evaluated without error but finished with a false/empty top stack element" when SCRIPT_ERR_VERIFY "Script failed an OP_VERIFY operation" when SCRIPT_ERR_EQUALVERIFY "Script failed an OP_EQUALVERIFY operation" when SCRIPT_ERR_CHECKMULTISIGVERIFY "Script failed an OP_CHECKMULTISIGVERIFY operation" when SCRIPT_ERR_CHECKSIGVERIFY "Script failed an OP_CHECKSIGVERIFY operation" when SCRIPT_ERR_NUMEQUALVERIFY "Script failed an OP_NUMEQUALVERIFY operation" when SCRIPT_ERR_SCRIPT_SIZE "Script is too big" when SCRIPT_ERR_PUSH_SIZE "Push value size limit exceeded" when SCRIPT_ERR_OP_COUNT "Operation limit exceeded" when SCRIPT_ERR_STACK_SIZE "Stack size limit exceeded" when SCRIPT_ERR_SIG_COUNT "Signature count negative or greater than pubkey count" when SCRIPT_ERR_PUBKEY_COUNT "Pubkey count negative or limit exceeded" when SCRIPT_ERR_BAD_OPCODE "Opcode missing or not understood" when SCRIPT_ERR_DISABLED_OPCODE "Attempted to use a disabled opcode" when SCRIPT_ERR_INVALID_STACK_OPERATION "Operation not valid with the current stack size" when SCRIPT_ERR_INVALID_ALTSTACK_OPERATION "Operation not valid with the current altstack size" when SCRIPT_ERR_OP_RETURN "OP_was encountered" when SCRIPT_ERR_UNBALANCED_CONDITIONAL "Invalid OP_IF construction" when SCRIPT_ERR_NEGATIVE_LOCKTIME "Negative locktime" when SCRIPT_ERR_UNSATISFIED_LOCKTIME "Locktime requirement not satisfied" when SCRIPT_ERR_SIG_HASHTYPE "Signature hash type missing or not understood" when SCRIPT_ERR_SIG_DER "Non-canonical DER signature" when SCRIPT_ERR_MINIMALDATA "Data push larger than necessary" when SCRIPT_ERR_SIG_PUSHONLY "Only non-push operators allowed in signatures" when SCRIPT_ERR_SIG_HIGH_S "Non-canonical signature S value is unnecessarily high" when SCRIPT_ERR_SIG_NULLDUMMY "Dummy CHECKMULTISIG argument must be zero" when SCRIPT_ERR_MINIMALIF "OP_IF/NOTIF argument must be minimal" when SCRIPT_ERR_SIG_NULLFAIL "Signature must be zero for failed CHECK(MULTI)SIG operation" when SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS "NOPx reserved for soft-fork upgrades" when SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM "Witness version reserved for soft-fork upgrades" when SCRIPT_ERR_PUBKEYTYPE "Public key is neither compressed or uncompressed" when SCRIPT_ERR_OP_CODESEPARATOR "Using OP_CODESEPARATOR in non-witness scrip" when SCRIPT_ERR_SIG_FINDANDDELETE "Signature is found in scriptCode" when SCRIPT_ERR_OP_COLOR_UNEXPECTED "Unexpected OP_COLOR in script" when SCRIPT_ERR_OP_COLOR_ID_INVALID "Invalid ColorId in script" when SCRIPT_ERR_OP_COLOR_MULTIPLE "Multiple OP_COLOR found in script" when SCRIPT_ERR_OP_COLOR_IN_BRANCH "OP_COLOR is not permitted in a script branch" when SCRIPT_ERR_UNKNOWN_ERROR, SCRIPT_ERR_ERROR_COUNT "unknown error" else extra_msg ? extra_msg : "unknown error" end end |