Hello. Help please with problem.
I created method at HotelPhotoNode actor.
public shared func getHotelPhotos(id: Nat32) : async (?[T.HotelPhoto]) {
let filteredList = List.filter<T.HotelPhoto>(hotelPhotoList, func h { h.id_hotel == id });
switch (filteredList) {
case (null) { return null; };
case (?list) {
if (List.isNil<T.HotelPhoto>(?list)) {
return null;
} else {
return ?List.toArray<T.HotelPhoto>(?list);
}
};
};
};
I trying to call it from another (main) actor.
public func getPhotoByHotel(id: Nat32) : async ?T.HotelPhoto {
for ((hotel_id, canister_id) in Trie.iter(_hpids)) {
if (hotel_id == id) {
let hotelPhotoNode = actor (canister_id) : actor {
getHotelPhotos : shared ( Nat32 ) -> async (?[T.HotelPhoto]);
};
let hotelPhoto = await hotelPhotoNode.getHotelPhotos(id);
switch(hotelPhoto)
{
case(null)
{
return null;
};
case(?arr)
{
let answer = arr[0];
return ?answer;
};
};
}
};
return null;
};
When i call getPhotoByHotel i got reject error:
Error: Failed update call.
Caused by: The replica returned a rejection error: reject code CanisterReject, reject message IC0503: Error from Canister edess-pmaaa-aaaaa-qaa4q-cai: Canister called `ic0.trap` with message: IDL error: unexpected IDL type when parsing Nat
Canister Backtrace:
@deserialize_go<N>
@deserialize<N>
getHotelPhotos
.
Consider gracefully handling failures from this canister or altering the canister to handle exceptions. See documentation: http://internetcomputer.org/docs/current/references/execution-errors#trapped-explicitly, error code None
If i understood correctly its misstake with types (Nat and Nat32), but thet are (both methods) using Nat32. Please help