]> git.ardis.lu - solc-metadata/commitdiff
Handle failure to extract CBOR
authorArdis Lu <ardisglu@gmail.com>
Thu, 10 Aug 2023 04:16:43 +0000 (21:16 -0700)
committerArdis Lu <ardisglu@gmail.com>
Thu, 10 Aug 2023 04:16:43 +0000 (21:16 -0700)
index.html

index 09d6f8cc4789075de102ed0bdb6365a00dc4f591..05f1914af910d4af96eed8d43463c03ae2209ff6 100644 (file)
 
       // Parse runtime bytecode
       const cbor = extractCBOR(bytecode);
+      if (cbor.includes(NaN)) {
+        result.insertAdjacentText('beforeend', '❌ Failed to extract CBOR metadata from bytecode.');
+        button.disabled = false;
+        spinner.style.setProperty('visibility', 'hidden');
+        return;
+      }
       logOutput(result, '✅ Successfully extracted CBOR metadata.', cbor.map(v => v.toString(16).padStart(2, '0')).join(''));
       const metadata = decodeCBOR(cbor);
       logOutput(result, '✅ Successfully decoded CBOR metadata.', JSON.stringify(metadata, null, 2));
This page took 0.035928 seconds and 4 git commands to generate.