deltaDAO / nautilus

The Data Economy TypeScript Toolkit
https://nautilus.delta-dao.com
Apache License 2.0
4 stars 2 forks source link

[Enhancement] Improve error message on access calls #71

Open moritzkirstein opened 6 months ago

moritzkirstein commented 6 months ago

Motivation / Problem

When trying to access an asset of type != 'access', the function call fails with a long stack trace.

Solution

We should imrpove the error handling and check if we can just verify the correct type of asset, even before doing the provider calls.

Alternatives

Additional context

Error trace

Creating new Nautilus instance with signer 0x...
[aquarius] Retrieve asset did:op:f2163fe539c72bf255fe96c8af32ae57b16ed4db76f71555d2401db0ec2dfb54 using cache at https://aquarius510.v4.delta-dao.com/
Error getting access details:  Cannot read properties of undefined (reading 'token')
[access] AccessDetails: undefined
Error initializing provider for access!
TypeError: Cannot read properties of undefined (reading 'id')
    at C:\node_typescript\node_modules\@deltadao\nautilus\src\utils\provider.ts:61:15
    at _catch (C:\node_typescript\node_modules\@deltadao\nautilus\src\utils\order.ts:251:2)
    at initializeProvider (C:\node_typescript\node_modules\@deltadao\nautilus\src\utils\provider.ts:56:44)
    at C:\node_typescript\node_modules\@deltadao\nautilus\src\access\index.ts:57:32
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async access (C:\node_typescript\utils\access.ts:4:21)
TypeError: Cannot read properties of null (reading 'providerFee')
    at C:\node_typescript\node_modules\@deltadao\nautilus\src\access\index.ts:69:20
    at processTicksAndRejections (node:internal/process/task_queues:96:5)