Skip to content

Commit

Permalink
optimize: optimize ensure panic (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeyJavaBean committed Apr 16, 2024
1 parent f227ad9 commit eddf8d5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions generator/golang/scope_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package golang
import (
"fmt"
"log"
"os"
"runtime/debug"
"strconv"
"strings"
Expand Down Expand Up @@ -440,13 +441,17 @@ func (s *Scope) resolveTypesAndValues(cu *CodeUtils) {

ensureType := func(t TypeName, e error) TypeName {
if e != nil {
panic(e)
println(s.ast.Filename)
println(e.Error())
os.Exit(2)
}
return t
}
ensureCode := func(c Code, e error) Code {
if e != nil {
panic(e)
println(s.ast.Filename)
println(e.Error())
os.Exit(2)
}
return c
}
Expand Down

0 comments on commit eddf8d5

Please sign in to comment.