Wails: panic: runtime error: index out of range [recovered]

Created on 30 Aug 2019  路  5Comments  路  Source: wailsapp/wails

Description

panic: runtime error: index out of range [recovered]

To Reproduce
Steps to reproduce the behaviour:

  1. I am using react but I guess it is the same on every front
componentDidMount(){
    window.backend.basic("filename");
  }
  1. Go part
func basic(fileName string) {
    fmt.Printf("basic bind with the message '%s'", fileName)
}
  1. Serve back and front
  2. See error

Expected behaviour
receive the value

Log

>>>>> To connect, you will need to run 'npm run start' in the 'frontend' directory <<<<<
panic: runtime error: index out of range [recovered]
        panic: interface conversion: interface {} is runtime.errorString, not string

goroutine 40 [running]:
github.com/wailsapp/wails/lib/binding.(*Manager).ProcessCall.func1(0xc0000bbce0)
        /home/bh90210/go/pkg/mod/github.com/wailsapp/[email protected]/lib/binding/manager.go:254 +0x15c
panic(0x821e00, 0xe66f40)
        /usr/local/go/src/runtime/panic.go:522 +0x1b5
github.com/wailsapp/wails/lib/binding.(*Manager).processFunctionCall(0xc00010e900, 0xc0002b43a0, 0xc00030cce0, 0x19, 0xc00030cca0, 0x1)
        /home/bh90210/go/pkg/mod/github.com/wailsapp/[email protected]/lib/binding/manager.go:198 +0x5d1
github.com/wailsapp/wails/lib/binding.(*Manager).ProcessCall(0xc00010e900, 0xc0002b43a0, 0x0, 0x0, 0x0, 0x0)
        /home/bh90210/go/pkg/mod/github.com/wailsapp/[email protected]/lib/binding/manager.go:260 +0x3cf
github.com/wailsapp/wails/lib/ipc.(*Manager).Start.func1.1(0x9a30e0, 0xc00010e900, 0xc0002b43a0, 0xc0000ad1c0, 0xc0002ce078)
        /home/bh90210/go/pkg/mod/github.com/wailsapp/[email protected]/lib/ipc/manager.go:64 +0x59
created by github.com/wailsapp/wails/lib/ipc.(*Manager).Start.func1
        /home/bh90210/go/pkg/mod/github.com/wailsapp/[email protected]/lib/ipc/manager.go:63 +0xada
Error: exit status 2

System Details

| Name | Value |
| ----- | ----- |
| Wails Version | v0.17.13-pre |
| Go Version | go1.12.6 |
| Platform | linux |
| Arch | amd64 |
| GO111MODULE | (Not Set) |
| GCC | 7.4.0 |
| Npm | v12.9.1 |
| Node | 6.10.2 |

Awaiting Feedback bug

Most helpful comment

@bh90210 Any updates?

All 5 comments

Looks like the requirement is to return a value from a bound function. We should still handle this better. Thanks 馃憤

I am pasting it here in plainer English :-p for fellow future newbs that might have the same issue

func basic(fileName string) string {
    fmt.Printf("basic bind with the message '%s'", fileName)
    return "success"
}

Latest develop has a fix for this. If you don't return anything from the function, it returns undefined as a result. Please test and let me know 馃憤

will test asap :+1:

@bh90210 Any updates?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

intelwalk picture intelwalk  路  4Comments

VladislavSournine picture VladislavSournine  路  5Comments

yosefbenshimon picture yosefbenshimon  路  5Comments

jonericcook picture jonericcook  路  6Comments

bh90210 picture bh90210  路  3Comments