2

When I try to compile this contract https://github.com/stove-labs/nft.stove-labs.com/blob/master/src/contracts/nft.ligo using the command

ligo compile-contract nft.ligo main > nft.tz

per the steps in the docs here https://nft.stove-labs.com/ I get the following output:

ligo: generated. unbound variable fail:  {"variable":"fail","environment":"- E[s -> record[contractOwner -> address , nfts -> (TO_Map (nat,record[catColor -> string , catName -> string , owner -> address]))] , action -> record[nftToMint -> record[catColor -> string , catName -> string , owner -> address] , nftToMintId -> nat] , arguments -> ( record[nftToMint -> record[catColor -> string , catName -> string , owner -> address] , nftToMintId -> nat] * record[contractOwner -> address , nfts -> (TO_Map (nat,record[catColor -> string , catName -> string , owner -> address]))] )]\tT[action -> sum[Burn -> record[nftToBurnId -> nat] , Mint -> record[nftToMint -> record[catColor -> string , catName -> string , owner -> address] , nftToMintId -> nat] , Transfer -> record[destination -> address , nftToTransfer -> nat]] , actionBurn -> record[nftToBurnId -> nat] , actionTransfer -> record[destination -> address , nftToTransfer -> nat] , actionMint -> record[nftToMint -> record[catColor -> string , catName -> string , owner -> address] , nftToMintId -> nat] , storageType -> record[contractOwner -> address , nfts -> (TO_Map (nat,record[catColor -> string , catName -> string , owner -> address]))] , nfts -> (TO_Map (nat,record[catColor -> string , catName -> string , owner -> address])) , nft -> record[catColor -> string , catName -> string , owner -> address] , nftId -> nat]\n]","location":"generated"}

1 Answer 1

1

Use the function failwith with a string argument describing the error, and cast it to the desired type if necessary (for example, if you are in an expression), like so: failwith ("My error"); or (failwith ("My error") : my_expected_type)

Note the parentheses around the string, as failwith is a function, not a keyword.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.