mirror of
https://github.com/schollz/croc.git
synced 2024-12-01 08:33:08 +03:00
better error
This commit is contained in:
parent
4fc40274db
commit
8a0800ca90
@ -34,7 +34,7 @@ func Decompress(src []byte) []byte {
|
||||
func compress(src []byte, dest io.Writer, level int) {
|
||||
compressor, _ := flate.NewWriter(dest, level)
|
||||
if _, err := compressor.Write(src); err != nil {
|
||||
log.Errorf("error writing data: %v", err)
|
||||
log.Debugf("error writing data: %v", err)
|
||||
}
|
||||
compressor.Close()
|
||||
}
|
||||
@ -43,7 +43,7 @@ func compress(src []byte, dest io.Writer, level int) {
|
||||
func decompress(src io.Reader, dest io.Writer) {
|
||||
decompressor := flate.NewReader(src)
|
||||
if _, err := io.Copy(dest, decompressor); err != nil {
|
||||
log.Errorf("error copying data: %v", err)
|
||||
log.Debugf("error copying data: %v", err)
|
||||
}
|
||||
decompressor.Close()
|
||||
}
|
||||
|
@ -579,7 +579,7 @@ func (c *Client) Receive() (err error) {
|
||||
log.Debugf("ips data: %s", data)
|
||||
var ips []string
|
||||
if err := json.Unmarshal(data, &ips); err != nil {
|
||||
log.Errorf("ips unmarshal error: %v", err)
|
||||
log.Debugf("ips unmarshal error: %v", err)
|
||||
}
|
||||
if len(ips) > 1 {
|
||||
port := ips[0]
|
||||
@ -698,6 +698,10 @@ func (c *Client) transfer(options TransferOptions) (err error) {
|
||||
log.Debugf("pake error: %s", err.Error())
|
||||
err = fmt.Errorf("password mismatch")
|
||||
}
|
||||
if err != nil && strings.Contains(err.Error(), "unexpected end of JSON input") {
|
||||
log.Debugf("error: %s", err.Error())
|
||||
err = fmt.Errorf("room not ready")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -705,7 +709,7 @@ func (c *Client) processMessageFileInfo(m message.Message) (done bool, err error
|
||||
var senderInfo SenderInfo
|
||||
err = json.Unmarshal(m.Bytes, &senderInfo)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
log.Debug(err)
|
||||
return
|
||||
}
|
||||
c.Options.SendingText = senderInfo.SendingText
|
||||
|
Loading…
Reference in New Issue
Block a user