本文整理汇总了Java中io.sentry.Sentry.capture方法的典型用法代码示例。如果您正苦于以下问题:Java Sentry.capture方法的具体用法?Java Sentry.capture怎么用?Java Sentry.capture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.sentry.Sentry
的用法示例。
在下文中一共展示了Sentry.capture方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPipeItem
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* spawns the pipeItem for all players (if they are near enough)
*/
public void createPipeItem(PipeItem pipeItem) {
try {
List<Player> playerList = LocationUtils.getPlayerList(pipeItem.getBlockLoc().getWorld());
for (Player on : playerList) {
if (on.getWorld().equals(pipeItem.getBlockLoc().getWorld())) {
if (pipeItem.getBlockLoc().distance(on.getLocation()) <= TransportPipes.instance.settingsUtils.getOrLoadPlayerSettings(on).getRenderDistance()) {
spawnItem(on, pipeItem);
}
}
}
} catch (Exception e) {
e.printStackTrace();
Sentry.capture(e);
}
}
示例2: updatePipeItem
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* updates the pipeItem (location) for all players (if they are near enough)
*/
public void updatePipeItem(PipeItem pipeItem) {
try {
List<Player> playerList = LocationUtils.getPlayerList(pipeItem.getBlockLoc().getWorld());
for (Player on : playerList) {
if (on.getWorld().equals(pipeItem.getBlockLoc().getWorld())) {
if (pipeItem.getBlockLoc().distance(on.getLocation()) <= TransportPipes.instance.settingsUtils.getOrLoadPlayerSettings(on).getRenderDistance()) {
getProtocol().updatePipeItem(on, pipeItem);
}
}
}
} catch (Exception e) {
e.printStackTrace();
Sentry.capture(e);
}
}
示例3: onReceive
import io.sentry.Sentry; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (gateway == null) {
gateway = new HTTPGateway(Config.shared().apiURL());
}
final Bundle bundle = intent.getExtras();
try {
if (null == bundle)
return;
final Object[] objects = (Object[]) bundle.get("pdus");
for (int i = 0, size = objects.length; i < size; i++) {
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) objects[i]);
String phoneNumber = smsMessage.getDisplayOriginatingAddress();
String body = smsMessage.getMessageBody();
Log.i(getClass().getName(), phoneNumber + " " + body);
gateway.message(phoneNumber, body);
}
} catch (Exception e) {
Log.e(getClass().getName(), e.getMessage());
Sentry.capture(e);
}
Log.i(getClass().getName(), "On receive");
}
示例4: job
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Create one job for the pipe.
* @param pipe The pipe
* @return The job for this pipe
*/
private Runnable job(final Pipe pipe) {
return new VerboseRunnable(
new RunnableOf<>(
new FuncWithFallback<Pipe, Boolean>(
new FuncOf<>(new Cycle(this.base)),
new FuncOf<>(
error -> {
Sentry.capture(error);
throw new IllegalStateException(error);
}
)
),
pipe
),
true, true
);
}
示例5: shutdownAndAwaitTermination
import io.sentry.Sentry; //导入方法依赖的package包/类
private static void shutdownAndAwaitTermination(ExecutorService executor)
{
executor.shutdown();
try {
if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
executor.shutdownNow();
if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
LOG.error("Failed to shutdown scheduler");
}
}
}
catch (InterruptedException e) {
Sentry.capture(e);
LOG.error("Scheduler shutdown interrupted: " + e.getMessage());
executor.shutdownNow();
Thread.currentThread().interrupt();
}
}
示例6: isBlockProtectedByLWC
import io.sentry.Sentry; //导入方法依赖的package包/类
public static boolean isBlockProtectedByLWC(Block b) {
if (Bukkit.getPluginManager().isPluginEnabled("LWC")) {
try {
return com.griefcraft.lwc.LWC.getInstance().findProtection(b) != null;
} catch (Exception e) {
e.printStackTrace();
Sentry.capture(e);
}
}
return false;
}
示例7: isBlockAtLocationOccluding
import io.sentry.Sentry; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private static boolean isBlockAtLocationOccluding(Location loc) {
try {
ChunkSnapshot snapshot = null;
int chunkX = (int) Math.floor(loc.getBlockX() / 16d);
int chunkZ = (int) Math.floor(loc.getBlockZ() / 16d);
ChunkCoords cc = new ChunkCoords(loc.getWorld().getName(), chunkX, chunkZ);
if (TransportPipes.instance.blockChangeListener.cachedChunkSnapshots.containsKey(cc)) {
snapshot = TransportPipes.instance.blockChangeListener.cachedChunkSnapshots.get(cc);
}
if (snapshot == null) {
return false;
}
int relativeX = loc.getBlockX() % 16;
if (relativeX < 0) {
relativeX = 16 + relativeX;
}
int relativeZ = loc.getBlockZ() % 16;
if (relativeZ < 0) {
relativeZ = 16 + relativeZ;
}
Material material = Material.getMaterial(snapshot.getBlockTypeId(relativeX, loc.getBlockY(), relativeZ));
return material.isOccluding();
} catch (Exception e) {
e.printStackTrace();
Sentry.capture(e);
return false;
}
}
示例8: fromString
import io.sentry.Sentry; //导入方法依赖的package包/类
@Override
public void fromString(String serialization) {
try {
for (String element : serialization.split(";")) {
if (element.startsWith("PipeType:")) {
setPipeType(PipeType.valueOf(element.substring(9)));
} else if (element.startsWith("PipeColor:")) {
setPipeColor(PipeColor.valueOf(element.substring(10)));
}
}
} catch (Exception e) {
e.printStackTrace();
Sentry.capture(e);
}
}
示例9: TkSafe
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Ctor.
* @param take Original take
*/
public TkSafe(final Take take) {
this.take = new TkFallback(
take,
new FbChain(
new FbStatus(
HttpURLConnection.HTTP_NOT_FOUND,
new RsWithStatus(
new RsText("Page not found"),
HttpURLConnection.HTTP_NOT_FOUND
)
),
new FbStatus(
HttpURLConnection.HTTP_BAD_REQUEST,
new RsWithStatus(
new RsText("Bad request"),
HttpURLConnection.HTTP_BAD_REQUEST
)
),
req -> {
Sentry.capture(req.throwable());
return new Opt.Empty<>();
},
req -> new TkFatal().route(req)
)
);
}
示例10: capture
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Capture a throwable and, if Sentry is enabled, sent to it
*
* @param throwable,
* the throwable to sent to Sentry
*/
public void capture(Throwable throwable) {
if (throwable != null) {
if (isSentryEnabled) {
LOGGER.debug("Sending throwable to Sentry: " + throwable.getMessage());
Sentry.capture(throwable);
} else {
LOGGER.debug("Sentry is not enabled, so no throwable is sent to it");
}
}
}
示例11: safe
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* With fallback.
* @param take Takes
* @return Safe takes
*/
private static Take safe(final Take take) {
return new TkFallback(
take,
new FbChain(
new FbStatus(
HttpURLConnection.HTTP_NOT_FOUND,
(Fallback) req -> new Opt.Single<>(
new RsWithStatus(
new RsText(req.throwable().getLocalizedMessage()),
HttpURLConnection.HTTP_NOT_FOUND
)
)
),
new FbStatus(
HttpURLConnection.HTTP_BAD_REQUEST,
(Fallback) req -> new Opt.Single<>(
new RsWithStatus(
new RsText(req.throwable().getLocalizedMessage()),
HttpURLConnection.HTTP_BAD_REQUEST
)
)
),
req -> {
Sentry.capture(req.throwable());
return new Opt.Empty<>();
},
req -> new Opt.Single<>(TkApp.fatal(req))
)
);
}
示例12: make
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Authenticated.
* @param take Takes
* @return Authenticated takes
*/
private static Take make(final Take take) {
return new TkFallback(
take,
new FbChain(
new FbStatus(
HttpURLConnection.HTTP_NOT_FOUND,
new RsWithStatus(
new RsText("Page not found"),
HttpURLConnection.HTTP_NOT_FOUND
)
),
new FbStatus(
HttpURLConnection.HTTP_BAD_REQUEST,
new RsWithStatus(
new RsText("Bad request"),
HttpURLConnection.HTTP_BAD_REQUEST
)
),
req -> {
Sentry.capture(req.throwable());
return new Opt.Empty<>();
},
req -> new Opt.Single<>(TkAppFallback.fatal(req))
)
);
}
示例13: make
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Authenticated.
* @param take Takes
* @return Authenticated takes
*/
private static Take make(final Take take) {
return new TkFallback(
take,
new FbChain(
new FbStatus(
HttpURLConnection.HTTP_NOT_FOUND,
new RsWithStatus(
new RsText("page not found"),
HttpURLConnection.HTTP_NOT_FOUND
)
),
new FbStatus(
HttpURLConnection.HTTP_BAD_REQUEST,
new RsWithStatus(
new RsText("bad request"),
HttpURLConnection.HTTP_BAD_REQUEST
)
),
req -> {
Sentry.capture(req.throwable());
return new Opt.Empty<>();
},
req -> new Opt.Single<>(TkAppFallback.fatal(req))
)
);
}
示例14: getToken
import io.sentry.Sentry; //导入方法依赖的package包/类
@Override
public String getToken()
{
while (true) {
AccessToken token = rotateToken();
GitHubClient client = new GitHubClient(token.getToken());
int remaining = client.getRateLimitRemaining();
// TODO: disable or delete if remaining is 0
if (remaining > RATE_LIMIT_ENABLED_THRESHOLD) {
LOG.info("found token: " + token.getToken() + " (" + Integer.valueOf(remaining).toString() + ")");
return token.getToken();
}
else if (remaining == 0) {
// just skip, maybe revoked or banned
LOG.info("skipped token: " + token.getToken() + " (" + Integer.valueOf(remaining).toString() + ")");
}
else {
LOG.info("failed token: " + token.getToken() + " (" + Integer.valueOf(remaining).toString() + ")");
try {
TimeUnit.SECONDS.sleep(3);
}
catch (InterruptedException e) {
Sentry.capture(e);
LOG.info("interrupt in token factory");
}
}
}
}
示例15: getPublicRepos
import io.sentry.Sentry; //导入方法依赖的package包/类
public List<Repository> getPublicRepos(Integer userId, boolean isOrganization)
throws IOException
{
List<Repository> repos = new ArrayList<>();
for (JsonObject node : getPublicRepoNodes(userId, isOrganization)) {
try {
Long id = decodeRepositoryId(node.getString("id"));
String encodedOwnerId = node.getJsonObject("owner").getString("id");
Integer ownerId = isOrganization ? decodeOrganizationId(encodedOwnerId) : decodeUserId(encodedOwnerId);
String name = node.getString("name");
String fullName = node.getString("nameWithOwner");
String description = node.isNull("description") ? null : node.getString("description");
Boolean fork = node.getBoolean("isFork");
String homepage = node.isNull("homepageUrl") ? null : node.getString("homepageUrl");
int stargazersCount = node.getJsonObject("stargazers").getInt("totalCount");
String language = node.isNull("primaryLanguage") ? null : node.getJsonObject("primaryLanguage").getString("name");
repos.add(new Repository(id, ownerId, name, fullName, description, fork, homepage, stargazersCount, language));
}
catch (ClassCastException e) {
Sentry.capture(e);
LOG.debug("node: " + node.toString());
throw e;
}
}
return repos;
}