mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 07:16:56 -05:00
Better exception output
This commit is contained in:
parent
08b327bf3a
commit
602ee0d5a1
4 changed files with 13 additions and 3 deletions
3
Makefile
3
Makefile
|
@ -14,11 +14,12 @@ TS_FILES = \
|
||||||
GO_FILES = \
|
GO_FILES = \
|
||||||
assets.go \
|
assets.go \
|
||||||
deno_dir.go \
|
deno_dir.go \
|
||||||
|
deno_dir_test.go \
|
||||||
dispatch.go \
|
dispatch.go \
|
||||||
main.go \
|
main.go \
|
||||||
main_test.go \
|
|
||||||
msg.pb.go \
|
msg.pb.go \
|
||||||
os.go \
|
os.go \
|
||||||
|
os_test.go \
|
||||||
timers.go \
|
timers.go \
|
||||||
util.go
|
util.go
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ func DispatchLoop() {
|
||||||
case msg := <-resChan:
|
case msg := <-resChan:
|
||||||
out, err := proto.Marshal(msg)
|
out, err := proto.Marshal(msg)
|
||||||
err = worker.SendBytes(out)
|
err = worker.SendBytes(out)
|
||||||
check(err)
|
exitOnError(err)
|
||||||
case <-doneChan:
|
case <-doneChan:
|
||||||
// All goroutines have completed. Now we can exit main().
|
// All goroutines have completed. Now we can exit main().
|
||||||
return
|
return
|
||||||
|
|
3
main.go
3
main.go
|
@ -52,7 +52,8 @@ func main() {
|
||||||
InitTimers()
|
InitTimers()
|
||||||
|
|
||||||
main_js := stringAsset("main.js")
|
main_js := stringAsset("main.js")
|
||||||
check(worker.Load("/main.js", main_js))
|
err := worker.Load("/main.js", main_js)
|
||||||
|
exitOnError(err)
|
||||||
main_map := stringAsset("main.map")
|
main_map := stringAsset("main.map")
|
||||||
|
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
|
|
8
util.go
8
util.go
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func assert(cond bool, msg string) {
|
func assert(cond bool, msg string) {
|
||||||
|
@ -21,3 +22,10 @@ func check(e error) {
|
||||||
panic(e)
|
panic(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func exitOnError(err error) {
|
||||||
|
if err != nil {
|
||||||
|
os.Stderr.WriteString(err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue