Standardized error reporting

This commit is contained in:
Xavi Ramirez 2017-08-20 23:42:27 +00:00
parent 8f7cbf9952
commit 09ea3282af

View file

@ -5,7 +5,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
"os"
"sync" "sync"
"time" "time"
) )
@ -181,12 +180,12 @@ func (kclp *KCLProcess) handleCheckpointAction(action ActionCheckpoint) error {
return fmt.Errorf("Encountered shutdown exception, skipping checkpoint") return fmt.Errorf("Encountered shutdown exception, skipping checkpoint")
case "ThrottlingException": case "ThrottlingException":
sleep := 5 * time.Second sleep := 5 * time.Second
fmt.Fprintf(os.Stderr, "Checkpointing throttling, pause for %s", sleep) kclp.ioHandler.writeError(fmt.Sprintf("Checkpointing throttling, pause for %s", sleep))
time.Sleep(sleep) time.Sleep(sleep)
case "InvalidStateException": case "InvalidStateException":
fmt.Fprintf(os.Stderr, "MultiLangDaemon invalid state while checkpointing") kclp.ioHandler.writeError("MultiLangDaemon invalid state while checkpointing")
default: default:
fmt.Fprintf(os.Stderr, "Encountered an error while checkpointing: %s", msg) kclp.ioHandler.writeError(fmt.Sprintf("Encountered an error while checkpointing: %s", msg))
} }
seq := action.SequenceNumber seq := action.SequenceNumber