mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
Add Fatal()
This commit is contained in:
parent
f6a16950f2
commit
f38c6c6d1c
2 changed files with 18 additions and 4 deletions
16
exp/pkg/application/errors.go
Normal file
16
exp/pkg/application/errors.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package application
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func Fatal(message string, args ...interface{}) {
|
||||
println("*********************** FATAL ***********************")
|
||||
println("There has been a catastrophic failure in your application.")
|
||||
println("Please report this error at https://github.com/wailsapp/wails/issues")
|
||||
println("******************** Error Details ******************")
|
||||
println(fmt.Sprintf(message, args...))
|
||||
println("*********************** FATAL ***********************")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ extern void dispatch(unsigned int id);
|
|||
*/
|
||||
import "C"
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
|
|
@ -22,7 +21,7 @@ func generateFunctionStoreID() uint {
|
|||
}
|
||||
startID++
|
||||
if startID == 0 {
|
||||
panic("Too many functions stored")
|
||||
Fatal("Too many functions have been dispatched to the main thread")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,8 +40,7 @@ func dispatchCallback(callbackID C.uint) {
|
|||
id := uint(callbackID)
|
||||
fn := mainThreadFuntionStore[id]
|
||||
if fn == nil {
|
||||
println("***** dispatchCallback called with invalid id: ", id)
|
||||
os.Exit(1)
|
||||
Fatal("dispatchCallback called with invalid id: ", id)
|
||||
}
|
||||
delete(mainThreadFuntionStore, id)
|
||||
mainThreadFuntionStoreLock.RUnlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue