Giter VIP home page Giter VIP logo

Comments (5)

janedegtiareva avatar janedegtiareva commented on September 24, 2024

This is a common developer mistake and currently can be a big devx detractor.

from near-api-js.

janedegtiareva avatar janedegtiareva commented on September 24, 2024

In NAJ, when we receive the arguments, we can check the arguments. We need contract metadata.

from near-api-js.

janedegtiareva avatar janedegtiareva commented on September 24, 2024

This needs design. Estimate is for following up with other teams to find out how to do this.

from near-api-js.

frol avatar frol commented on September 24, 2024

Just for the record, currently, the error message is less cryptic:

Error:  Error: Querying call/dev-1614893283391-2068372/get_status failed: wasm execution failed with error: FunctionCallError(HostError(GuestPanic { panic_msg: "panicked at \'Failed to deserialize input from JSON.: Error(\"missing field `account_id`\", line: 1, column: 40)\', src/lib.rs:22:1" })).
{
  "error": "wasm execution failed with error: FunctionCallError(HostError(GuestPanic { panic_msg: \"panicked at \\'Failed to deserialize input from JSON.: Error(\\\"missing field `account_id`\\\", line: 1, column: 40)\\', src/lib.rs:22:1\" }))",
  "logs": [],
  "block_height": 38844509,
  "block_hash": "APNzn7CxYTr2hdV7d29Gtt8KaWgBrGxTiif6pydVHK9n"
}
    at JsonRpcProvider.query (/usr/lib/node_modules/near-shell/node_modules/near-api-js/lib/providers/json-rpc-provider.js:67:19)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async Account.viewFunction (/usr/lib/node_modules/near-shell/node_modules/near-api-js/lib/account.js:272:24)
    at async exports.callViewFunction (/usr/lib/node_modules/near-shell/index.js:64:48)
    at async Object.handler (/usr/lib/node_modules/near-shell/utils/exit-on-error.js:37:9)

Yet, it depends on how the contract itself reports the error. JSON parser in Rust provides a helpful message while JSON parser in AssemblyScript might be not that friendly. If AssemblyScript contracts still just crash without any message, we need to address it on the near-sdk-as level.

That said, these are errors from inside the smart contract, these two are generated by JSON parser compiled into the contract.

To do anything with that, we need to define some sort of error API layer for the smart contracts just like we discuss the events API, and come up with some helpful magic for the end-users on the SDK side.

from near-api-js.

volovyks avatar volovyks commented on September 24, 2024

Downgrading to P2 since it's not near-api-js issue.
Further actions:

  • wait for near/near-sdk-as#443 to close
  • check if the new error is readable, has type, and clear to understand
  • close this issue

from near-api-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.