public static <T> DbxWrappedException fromResponse(StoneSerializer<T> errSerializer, HttpRequestor.Response response, String userId)
throws IOException, JsonParseException {
String requestId = DbxRequestUtil.getRequestId(response);
ApiErrorResponse<T> apiResponse = new ApiErrorResponse.Serializer<T>(errSerializer)
.deserialize(response.getBody());
T routeError = apiResponse.getError();
DbxGlobalCallbackFactory factory = DbxRequestUtil.sharedCallbackFactory;
DbxWrappedException.executeBlockForObject(factory, userId, routeError);
DbxWrappedException.executeOtherBlocks(factory, userId, routeError);
return new DbxWrappedException(routeError, requestId, apiResponse.getUserMessage());
}