EngineIOException
This commit is contained in:
@@ -88,6 +88,7 @@ public class Emitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static interface Listener {
|
public static interface Listener {
|
||||||
|
|
||||||
public void call(Object... args);
|
public void call(Object... args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.github.nkzawa.engineio.client;
|
||||||
|
|
||||||
|
public class EngineIOException extends Exception {
|
||||||
|
|
||||||
|
public EngineIOException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public EngineIOException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EngineIOException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EngineIOException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -188,8 +188,8 @@ public abstract class Socket extends Emitter {
|
|||||||
|
|
||||||
// TODO: handle error
|
// TODO: handle error
|
||||||
Exception err = args.length > 0 ? (Exception)args[0] : null;
|
Exception err = args.length > 0 ? (Exception)args[0] : null;
|
||||||
Transport.TransportException error = new Transport.TransportException("probe error", err);
|
EngineIOException error = new EngineIOException("probe error", err);
|
||||||
error.transport = transport[0].name;
|
//error.transport = transport[0].name;
|
||||||
|
|
||||||
transport[0].close();
|
transport[0].close();
|
||||||
transport[0] = null;
|
transport[0] = null;
|
||||||
@@ -239,8 +239,8 @@ public abstract class Socket extends Emitter {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
logger.info(String.format("probe transport '%s' failed", name));
|
logger.info(String.format("probe transport '%s' failed", name));
|
||||||
Transport.TransportException err = new Transport.TransportException("probe error");
|
EngineIOException err = new EngineIOException("probe error");
|
||||||
err.transport = transport[0].name;
|
//err.transport = transport[0].name;
|
||||||
self.emit("error", err);
|
self.emit("error", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,8 +305,8 @@ public abstract class Socket extends Emitter {
|
|||||||
this.ping();
|
this.ping();
|
||||||
} else if ("error".equals(packet.type)) {
|
} else if ("error".equals(packet.type)) {
|
||||||
// TODO: handle error
|
// TODO: handle error
|
||||||
Exception err = new Exception("server error");
|
EngineIOException err = new EngineIOException("server error");
|
||||||
// err.code = packet.data;
|
//err.code = packet.data;
|
||||||
this.emit("error", err);
|
this.emit("error", err);
|
||||||
} else if ("message".equals(packet.type)) {
|
} else if ("message".equals(packet.type)) {
|
||||||
this.emit("data", packet.data);
|
this.emit("data", packet.data);
|
||||||
@@ -491,7 +491,7 @@ public abstract class Socket extends Emitter {
|
|||||||
this.onclose();
|
this.onclose();
|
||||||
// TODO:
|
// TODO:
|
||||||
// clean buffer in next tick, so developers can still
|
// clean buffer in next tick, so developers can still
|
||||||
// gra the buffers on `close` event
|
// grab the buffers on `close` event
|
||||||
// setTimeout(function() {}
|
// setTimeout(function() {}
|
||||||
// self.writeBuffer = [];
|
// self.writeBuffer = [];
|
||||||
// self.callbackBuffer = [];
|
// self.callbackBuffer = [];
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ public abstract class Transport extends Emitter {
|
|||||||
protected String timestampParam;
|
protected String timestampParam;
|
||||||
protected String readyState = "";
|
protected String readyState = "";
|
||||||
|
|
||||||
public Transport() {
|
|
||||||
// TODO: remove
|
|
||||||
}
|
|
||||||
|
|
||||||
public Transport(Options opts) {
|
public Transport(Options opts) {
|
||||||
this.path = opts.path;
|
this.path = opts.path;
|
||||||
@@ -37,10 +34,8 @@ public abstract class Transport extends Emitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Transport onError(String msg, Exception desc) {
|
protected Transport onError(String msg, Exception desc) {
|
||||||
// TODO:
|
// TODO: handle error
|
||||||
Exception err = new Exception(msg);
|
Exception err = new EngineIOException(msg, desc);
|
||||||
// err.type = "TransportError";
|
|
||||||
// err.description = desc;
|
|
||||||
this.emit("error", err);
|
this.emit("error", err);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -107,17 +102,4 @@ public abstract class Transport extends Emitter {
|
|||||||
public List<NameValuePair> query;
|
public List<NameValuePair> query;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TransportException extends Exception {
|
|
||||||
|
|
||||||
public String transport;
|
|
||||||
|
|
||||||
public TransportException(String detailMessage) {
|
|
||||||
super(detailMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TransportException(String detailMessage, Throwable throwable) {
|
|
||||||
super(detailMessage, throwable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ public class PollingXHR extends Polling {
|
|||||||
}
|
}
|
||||||
this.onData(data.toString());
|
this.onData(data.toString());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
this.onError(e);
|
this.onError(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user