1

I would like to know if there is some way of testing for error raised with failwith in ligo using the testing framework?

There doesn’t seem to be any documented try-catch mechanism yet, or am I mistaken ?

Here is a simplified version of the code I want to test:

type identity_card = {
    first_name: string;
    last_name: string;
    validators: address set;
}

type t = (address, identity_card) map


let find (trombi:t) (user_address:address) = 
    match Map.find_opt user_address trombi with 
        Some card -> card
       |None  -> failwith("not found")

1 Answer 1

0

You don't have try..catch

I suggest that you look at the returned object of the transaction call, you have the information there

 const status =
    Test.transfer_to_contract(contrNFT, CreateNFTCardForMember(), 0 as mutez);
 const _ = Test.log(["status", status]);

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.