final StringBuilder sb = new StringBuilder();
for(Object arg : args) {
sb.append(arg);
+ if(arg instanceof Throwable) {
+ sb.append("\nCauses (including original):\n");
+ final Throwable error = (Throwable) arg;
+ Throwable cause = error;
+ while(cause != null) {
+ sb.append(" ");
+ sb.append(cause.toString());
+ sb.append("\n");
+ cause = cause.getCause();
+ }
+
+ sb.append("Stack trace of original: ");
+ sb.append(error.toString());
+ sb.append("\n");
+ StackTraceElement[] stackTrace = error.getStackTrace();
+ for(StackTraceElement errorElem : stackTrace) {
+ sb.append(" ");
+ sb.append(errorElem.toString());
+ sb.append("\n");
+ }
+ }
}
+
+
if(sb.length() > 0) {
__ConsoleLog(sb.toString());
}
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue;
+import gr.grnet.pithos.web.client.Const;
import gr.grnet.pithos.web.client.Helpers;
import gr.grnet.pithos.web.client.Pithos;
* The request via which we obtain user catalog info.
*/
public class GetUserCatalogs implements Scheduler.ScheduledCommand {
+ private final Pithos app;
private final String url;
private final String userToken;
private final List<String> ids;
public GetUserCatalogs(Pithos app, List<String> ids, List<String> names) {
assert app != null;
+ this.app = app;
+
// FIXME: Probably use Window.Location.getHost()
// https://server.com/v1/ --> https://server.com
String path = app.getApiPath();
}
public void onError(Request request, Throwable t) {
- GWT.log("GetUserCatalogs", t);
+ app.LOG("GetUserCatalogs ", t);
}
@Override
public void execute() {
final RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, getURL());
- rb.setHeader("X-Auth-Token", userToken);
+ rb.setHeader(Const.X_AUTH_TOKEN, userToken);
final String requestData = makeRequestData().toString();
+ app.LOG("GetUserCatalog => ", requestData);
+ app.LOG(new Exception());
try {
rb.sendRequest(requestData, new RequestCallback() {
final int statusCode = response.getStatusCode();
if(statusCode != SuccessCode) {
+ app.LOG("GetUserCatalog <= [", statusCode, " ", response.getStatusText(), "]");
GetUserCatalogs.this.onBadStatusCode(request, response);
return;
}
final String responseText = response.getText();
final JSONValue jsonValue = JSONParser.parseStrict(responseText);
+ app.LOG("GetUserCatalog <= ", jsonValue.toString());
final JSONObject result = jsonValue.isObject();
if(result == null) {
});
}
catch(Exception e) {
- GWT.log("GetUserCatalogs", e);
+ app.LOG("GetUserCatalogs. ", e);
}
}