Report better errors for non-repl languages
This commit is contained in:
parent
cc8d54ef75
commit
7e13eada31
|
@ -58,6 +58,10 @@ export class Session {
|
|||
try {
|
||||
setTimeout(this.teardown, 3600 * 1000); // max session length of 1hr
|
||||
allSessions.add(this);
|
||||
this.send({
|
||||
event: "langConfig",
|
||||
config: this.config,
|
||||
});
|
||||
const containerArgs = this.privilegedSession();
|
||||
const containerProc = spawn(containerArgs[0], containerArgs.slice(1));
|
||||
this.container = {
|
||||
|
|
|
@ -31,6 +31,15 @@ type message struct {
|
|||
Event string `json:"event"`
|
||||
}
|
||||
|
||||
type langConfig struct {
|
||||
message
|
||||
Config struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Repl string `json:"repl"`
|
||||
} `json:"config"`
|
||||
}
|
||||
|
||||
type errorMessage struct {
|
||||
message
|
||||
Error string `json:"errorMessage"`
|
||||
|
@ -121,6 +130,16 @@ func run() error {
|
|||
return
|
||||
}
|
||||
done1 <- errors.New(msg.Error)
|
||||
case "langConfig":
|
||||
var msg langConfig
|
||||
if err := json.Unmarshal(rawMsg, &msg); err != nil {
|
||||
done1 <- errors.Wrap(err, "failed to parse websocket message")
|
||||
return
|
||||
}
|
||||
if msg.Config.Repl == "" {
|
||||
done1 <- fmt.Errorf("%s has no repl, you must provide a file to run", msg.Config.Name)
|
||||
return
|
||||
}
|
||||
case "terminalOutput":
|
||||
var msg terminalOutput
|
||||
if err := json.Unmarshal(rawMsg, &msg); err != nil {
|
||||
|
|
Loading…
Reference in New Issue