permaweb/aos

`aos --load [file]` does not report errors

MichaelBuhler opened this issue · 4 comments

If my loaded file has bad/improper Lua in it, I get no errors on the console.

The error does come back from from the CU, but the client is not handling it, instead dropping straight to the prompt:

⠼  [Connecting to Process...]

send: 1.168s


⠋  [Computing DhRcw6B8O9zdLiBAlb-TofP_GeJ1MlKTLKQTnPQu2jk state transformations]  @permaweb/aoconnect:result fetching message result from CU https://cu.ao-testnet.xyz/result/DhRcw6B8O9zdLiBAlb-TofP_GeJ1MlKTLKQTnPQu2jk?process-id=kE-LZ4rFwjrCVf00l2n4bQusfDZVTf5Z2HX1fS9xwa0 +0ms
⠴  [Computing DhRcw6B8O9zdLiBAlb-TofP_GeJ1MlKTLKQTnPQu2jk state transformations]  @permaweb/aoconnect:result readResult result for message "DhRcw6B8O9zdLiBAlb-TofP_GeJ1MlKTLKQTnPQu2jk": {
  @permaweb/aoconnect:result   Messages: [],
  @permaweb/aoconnect:result   Spawns: [],
  @permaweb/aoconnect:result   Output: { data: { output: 1984, prompt: 'aos> ', json: 'undefined' } },
  @permaweb/aoconnect:result   GasUsed: 517987171
  @permaweb/aoconnect:result } +1s


read: 1.703s


connecting: 2.886s
Loading...  src/pre-check.lua
⠼  [Signing message and sequencing...]

send: 332.587ms


⠋  [Computing N5AsFIjDclDf9CMzY-H0LlIYzNq3w67mL1Q0V4eRFwM state transformations]  @permaweb/aoconnect:result fetching message result from CU https://cu.ao-testnet.xyz/result/N5AsFIjDclDf9CMzY-H0LlIYzNq3w67mL1Q0V4eRFwM?process-id=kE-LZ4rFwjrCVf00l2n4bQusfDZVTf5Z2HX1fS9xwa0 +0ms
⠸  [Computing N5AsFIjDclDf9CMzY-H0LlIYzNq3w67mL1Q0V4eRFwM state transformations]  @permaweb/aoconnect:result readResult result for message "N5AsFIjDclDf9CMzY-H0LlIYzNq3w67mL1Q0V4eRFwM": {
  @permaweb/aoconnect:result   Messages: [],
  @permaweb/aoconnect:result   Spawns: [],
  @permaweb/aoconnect:result   Output: '',
  @permaweb/aoconnect:result   GasUsed: 526113044,
  @permaweb/aoconnect:result   Error: `[string ".handlers"]:335: [string "aos"]:5: attempt to call a nil value (global 'asset')`
  @permaweb/aoconnect:result } +289ms


read: 790.246ms


aos> 

Also, if multiple files are loaded aos --load [file1] --load [file2] and file1 has an error, then it appears that file2 is NOT loaded, even though the the client already printing the file2 loading message before uploading file1.

Edit: To be clear, I agree that file2 should not be loaded. Just that the aos client should not print that it is loading before it is actually doing so.

Loading...  src/pre-check.lua
Loading...  src/post-check.lua
⠼  [Signing message and sequencing...]

send: 331.632ms


⠋  [Computing uwoDVL9dkg_BVuCjjIa5ZZWUHYTAWuDvIHUArfOWqEU state transformations]  @permaweb/aoconnect:result fetching message result from CU https://cu.ao-testnet.xyz/result/uwoDVL9dkg_BVuCjjIa5ZZWUHYTAWuDvIHUArfOWqEU?process-id=kE-LZ4rFwjrCVf00l2n4bQusfDZVTf5Z2HX1fS9xwa0 +0ms
⠸  [Computing uwoDVL9dkg_BVuCjjIa5ZZWUHYTAWuDvIHUArfOWqEU state transformations]  @permaweb/aoconnect:result readResult result for message "uwoDVL9dkg_BVuCjjIa5ZZWUHYTAWuDvIHUArfOWqEU": {
  @permaweb/aoconnect:result   Messages: [],
  @permaweb/aoconnect:result   Spawns: [],
  @permaweb/aoconnect:result   Output: '',
  @permaweb/aoconnect:result   GasUsed: 549265199,
  @permaweb/aoconnect:result   Error: `[string ".handlers"]:335: [string "aos"]:5: attempt to call a nil value (global 'asset')`
  @permaweb/aoconnect:result } +274ms


read: 775.107ms


aos> 

Also would like to consider NOT dropping down into the repl after a --load command, so that --load can be used programmatically in shell scripts. Perhaps with the addition of --[no-]repl or --[no-]interactive flags. Could be a separate GitHub issue.

Additional testing has revealed that all loaded files at actually concatenated and uploaded together as a single file. 🤔

Dropping into a REPL can already be avoided by piping the file into via stdin in combination with the --load option.