Non publish shared Portal Item Load issue

101
0
2 weeks ago
NickXu
by
New Contributor

Hi,

I  have a script to load portal item as:

const item= new PortalItem( {
            // autocasts as new PortalItem()
            id: item_properties.item_id,
            portal:{url:item_properties.portal_url}
        })
item.load()
                .then((loaded_item: PortalItem)=>{
                    console.log(loaded_item.isLayer)
 
                }).catch(e => {
                    console.log(`load item error ${item_properties.item_id}`, e.message)
                }).finally(()=>{
                    console.log(`finally load item status: ${item.loadStatus}` )
                })
 
This script works when portal item requested is shared with everyone or doesn't exist; however, when the item is shared with owner or organization, it doesn't throw any error and no "FINALLY" executed.
 
I'm using js 4.25.
 
How do i catch message when portal item is not accessible?
 
Thanks!
 
Nick
0 Kudos
0 Replies