Skip to content

Commit

Permalink
Merge pull request #156 from kristjanpeterson1/error-response-checking
Browse files Browse the repository at this point in the history
Remove null checks for errors because errors with no content are not …
  • Loading branch information
codeSTACKr authored Apr 28, 2022
2 parents e57d27d + dc5ac3f commit aa71315
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion utils/nftport/checkTxns.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function main() {
? txnData.mintData.response
: txnData.updateData.response;
const err =
dir === "minted" ? txnData.mintData.error : txnData.updateData.error;
(dir === "minted" ? txnData.mintData.error : txnData.updateData.error) || null;
const verified =
dir === "minted"
? txnData.mintData.transaction_verified
Expand Down
7 changes: 2 additions & 5 deletions utils/nftport/mint.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ async function main() {
const mintedFile = fs.readFileSync(mintFile);
if (mintedFile.length > 0) {
const mintedMeta = JSON.parse(mintedFile);
if (
mintedMeta.mintData.response !== "OK" ||
mintedMeta.mintData.error !== null
) {
if (mintedMeta.mintData.response !== "OK") {
console.log(
`Response: ${mintedMeta.mintData.response}`,
`Error: ${mintedMeta.mintData.error}`,
Expand Down Expand Up @@ -128,7 +125,7 @@ async function main() {
JSON.stringify(combinedData, null, 2)
);

if (mintData.response !== "OK" || mintData.error !== null) {
if (mintData.response !== "OK") {
console.log(
`Minting ${meta.name} failed :(`,
`Response: ${mintData.response}`,
Expand Down
2 changes: 1 addition & 1 deletion utils/nftport/revealNFTs.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async function reveal() {
const revealedFile = fs.readFileSync(revealedFilePath);
if (revealedFile.length > 0) {
const revealedFileJson = JSON.parse(revealedFile);
if (revealedFileJson.updateData.response !== "OK" || revealedFileJson.updateData.error !== null) {
if (revealedFileJson.updateData.response !== "OK") {
throw "not revealed";
} else if(revealedFileJson.updateData.transaction_verified === true) {
console.log(`${meta.name} already revealed.`);
Expand Down

0 comments on commit aa71315

Please sign in to comment.