forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
panic_cmd.go
38 lines (32 loc) · 1.05 KB
/
panic_cmd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2015, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package worker
import (
"flag"
"fmt"
"html/template"
"net/http"
"github.com/youtube/vitess/go/vt/wrangler"
"golang.org/x/net/context"
)
func commandPanic(wi *Instance, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) (Worker, error) {
worker, err := NewPanicWorker(wr)
if err != nil {
return nil, fmt.Errorf("Could not create Panic worker: %v", err)
}
return worker, nil
}
func interactivePanic(ctx context.Context, wi *Instance, wr *wrangler.Wrangler, w http.ResponseWriter, r *http.Request) (Worker, *template.Template, map[string]interface{}, error) {
wrk, err := NewPanicWorker(wr)
if err != nil {
return nil, nil, nil, fmt.Errorf("Could not create Panic worker: %v", err)
}
return wrk, nil, nil, nil
}
func init() {
AddCommand("Debugging", Command{"Panic",
commandPanic, interactivePanic,
"<message>",
"For internal tests only. Will call panic() when executed."})
}