• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ResponseErrorException类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.eclipse.lsp4j.jsonrpc.ResponseErrorException的典型用法代码示例。如果您正苦于以下问题:Java ResponseErrorException类的具体用法?Java ResponseErrorException怎么用?Java ResponseErrorException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ResponseErrorException类属于org.eclipse.lsp4j.jsonrpc包,在下文中一共展示了ResponseErrorException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: request

点赞 3

import org.eclipse.lsp4j.jsonrpc.ResponseErrorException; //导入依赖的package包/类
@Override
public CompletableFuture<?> request(String method, Object parameter) {
	Function<Object, CompletableFuture<Object>> handler = methodHandlers.get(method);
	if (handler != null) {
		return handler.apply(parameter);
	}
	if (delegate instanceof Endpoint) {
		return ((Endpoint) delegate).request(method, parameter);
	}
	String message = "Unsupported request method: " + method;
	if (isOptionalMethod(method)) {
		LOG.log(Level.INFO, message);
		return CompletableFuture.completedFuture(null);
	}
	LOG.log(Level.WARNING, message);
	CompletableFuture<?> exceptionalResult = new CompletableFuture<Object>();
	ResponseError error = new ResponseError(ResponseErrorCode.MethodNotFound, message, null);
	exceptionalResult.completeExceptionally(new ResponseErrorException(error));
	return exceptionalResult;
}
 

开发者ID:smarr,
项目名称:SOMns-vscode,
代码行数:21,
代码来源:GenericEndpoint.java

示例2: testExecuteCommandNonexistingCommand

点赞 2

import org.eclipse.lsp4j.jsonrpc.ResponseErrorException; //导入依赖的package包/类
@Test
public void testExecuteCommandNonexistingCommand() {
	expectedEx.expect(ResponseErrorException.class);
	expectedEx.expectMessage("No delegateCommandHandler for testcommand.not.existing");

	WorkspaceExecuteCommandHandler handler = new WorkspaceExecuteCommandHandler();
	ExecuteCommandParams params = new ExecuteCommandParams();
	params.setCommand("testcommand.not.existing");
	params.setArguments(Arrays.asList("hello", "world"));
	Object result = handler.executeCommand(params, monitor);
}
 

开发者ID:eclipse,
项目名称:eclipse.jdt.ls,
代码行数:12,
代码来源:WorkspaceExecuteCommandHandlerTest.java

示例3: testExecuteCommandThrowsExceptionCommand

点赞 2

import org.eclipse.lsp4j.jsonrpc.ResponseErrorException; //导入依赖的package包/类
@Test
public void testExecuteCommandThrowsExceptionCommand() {
	expectedEx.expect(ResponseErrorException.class);
	expectedEx.expectMessage("Unsupported");

	WorkspaceExecuteCommandHandler handler = new WorkspaceExecuteCommandHandler();
	ExecuteCommandParams params = new ExecuteCommandParams();
	params.setCommand("testcommand.throwexception");
	handler.executeCommand(params, monitor);
}
 

开发者ID:eclipse,
项目名称:eclipse.jdt.ls,
代码行数:11,
代码来源:WorkspaceExecuteCommandHandlerTest.java

示例4: testExecuteCommandInvalidParameters

点赞 2

import org.eclipse.lsp4j.jsonrpc.ResponseErrorException; //导入依赖的package包/类
@Test
public void testExecuteCommandInvalidParameters() {
	expectedEx.expect(ResponseErrorException.class);
	expectedEx.expectMessage("The workspace/executeCommand has empty params or command");

	WorkspaceExecuteCommandHandler handler = new WorkspaceExecuteCommandHandler();
	ExecuteCommandParams params = null;
	handler.executeCommand(params, monitor);
}
 

开发者ID:eclipse,
项目名称:eclipse.jdt.ls,
代码行数:10,
代码来源:WorkspaceExecuteCommandHandlerTest.java

示例5: checkSeverity

点赞 2

import org.eclipse.lsp4j.jsonrpc.ResponseErrorException; //导入依赖的package包/类
public void checkSeverity() {
  RefactoringIssueAcceptor.Severity _maximumSeverity = this.getMaximumSeverity();
  boolean _lessThan = (_maximumSeverity.compareTo(RefactoringIssueAcceptor.Severity.WARNING) < 0);
  if (_lessThan) {
    ResponseError _responseError = this.toResponseError();
    throw new ResponseErrorException(_responseError);
  }
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:9,
代码来源:ServerRefactoringIssueAcceptor.java

示例6: getWorkspaceConfig

点赞 2

import org.eclipse.lsp4j.jsonrpc.ResponseErrorException; //导入依赖的package包/类
protected IWorkspaceConfig getWorkspaceConfig() {
  if ((this._workspaceConfig == null)) {
    final ResponseError error = new ResponseError(ResponseErrorCode.serverNotInitialized, 
      "Workspace has not been initialized yet.", null);
    throw new ResponseErrorException(error);
  }
  return this._workspaceConfig;
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:9,
代码来源:WorkspaceManager.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)