mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 18:38:11 +03:00
Add JSON-RPC Timeout Error (#1332)
Add a separate timeout error to distinguish between the request timeouts and other service errors.
This commit is contained in:
parent
95a345ee26
commit
a6b2415188
4
.github/CODEOWNERS
vendored
4
.github/CODEOWNERS
vendored
@ -10,8 +10,8 @@
|
||||
/lib/scala/flexer @iamrecursion @kustosz
|
||||
/lib/scala/graph @iamrecursion @kustosz
|
||||
/lib/scala/interpreter-dsl @iamrecursion @kustosz
|
||||
/lib/scala/json-rpc-server @lolczak @4e6 @iamrecursion
|
||||
/lib/scala/json-rpc-server-test @lolczak @4e6 @iamrecursion
|
||||
/lib/scala/json-rpc-server @lolczak @4e6 @iamrecursion @kustosz
|
||||
/lib/scala/json-rpc-server-test @lolczak @4e6 @iamrecursion @kustosz
|
||||
/lib/scala/logger @kustosz @iamrecursion
|
||||
/lib/scala/parser-service @kustosz @iamrecursion
|
||||
/lib/scala/pkg @iamrecursion @kustosz
|
||||
|
@ -28,6 +28,7 @@ transport formats, please look [here](./protocol-architecture.md).
|
||||
- [`InvalidParams`](#invalidparams)
|
||||
- [`ServiceError`](#serviceerror)
|
||||
- [`NotImplementedError`](#notimplementederror)
|
||||
- [`RequestTimeoutError`](#requesttimeouterror)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
@ -197,3 +198,14 @@ implemented yet.
|
||||
"message" : "The requested method is not implemented"
|
||||
}
|
||||
```
|
||||
|
||||
### `RequestTimeoutError`
|
||||
|
||||
Signals that request exceeded the waiting time.
|
||||
|
||||
```typescript
|
||||
"error" : {
|
||||
"code" : 11,
|
||||
"message" : "Request timeout"
|
||||
}
|
||||
```
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.capability
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.capability.CapabilityApi.AcquireCapability
|
||||
import org.enso.languageserver.capability.CapabilityProtocol
|
||||
@ -54,7 +53,7 @@ class AcquireCapabilityHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Acquiring capability for ${session.clientId} timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case CapabilityAcquired =>
|
||||
@ -63,7 +62,7 @@ class AcquireCapabilityHandler(
|
||||
context.stop(self)
|
||||
|
||||
case CapabilityAcquisitionBadRequest =>
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.capability
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.capability.CapabilityApi.{
|
||||
CapabilityNotAcquired,
|
||||
@ -52,7 +51,7 @@ class ReleaseCapabilityHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Releasing capability for ${session.clientId} timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case CapabilityReleased =>
|
||||
@ -61,7 +60,7 @@ class ReleaseCapabilityHandler(
|
||||
context.stop(self)
|
||||
|
||||
case CapabilityReleaseBadRequest =>
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.executioncontext
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.data.{
|
||||
CanModify,
|
||||
@ -53,7 +52,7 @@ class CreateHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case CreateContextResponse(contextId) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.executioncontext
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.ExecutionApi._
|
||||
@ -52,7 +51,7 @@ class DestroyHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case DestroyContextResponse(_) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.executioncontext
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.ExecutionApi._
|
||||
@ -48,7 +47,7 @@ class PopHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case PopContextResponse(_) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.executioncontext
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.ExecutionApi._
|
||||
@ -56,7 +55,7 @@ class PushHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case PushContextResponse(_) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.executioncontext
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.ExecutionApi._
|
||||
@ -56,7 +55,7 @@ class RecomputeHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case RecomputeContextResponse(_) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -37,13 +36,13 @@ class CopyFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $CopyFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.CopyFileResult(Left(failure)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -37,13 +36,13 @@ class CreateFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $CreateFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.CreateFileResult(Left(failure)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileDeletedEvent,
|
||||
@ -40,13 +39,13 @@ class DeleteFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $DeleteFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.DeleteFileResult(Left(failure)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -37,13 +36,13 @@ class ExistsFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $ExistsFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.ExistsFileResult(Left(failure)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -42,13 +41,13 @@ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $InfoFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.InfoFileResult(Left(failure)) =>
|
||||
@ -68,9 +67,9 @@ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
|
||||
object InfoFileHandler {
|
||||
|
||||
/** Creates a configuration object used to create a [[InfoFileHandler]]
|
||||
/** Creates a configuration object used to create a [[InfoFileHandler]].
|
||||
*
|
||||
* @param requestTimeout a request timeout
|
||||
* @param timeout a request timeout
|
||||
* @param fileManager a file system manager actor
|
||||
*/
|
||||
def props(timeout: FiniteDuration, fileManager: ActorRef): Props =
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -37,13 +36,13 @@ class ListFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $ListFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.ListFileResult(Left(failure)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -37,13 +36,13 @@ class MoveFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $MoveFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.MoveFileResult(Left(failure)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -39,13 +38,13 @@ class ReadTextualFileHandler(
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $ReadFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.ReadTextualFileResult(Left(failure)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -37,13 +36,13 @@ class TreeFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $TreeFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.TreeFileResult(Left(failure)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.file
|
||||
|
||||
import akka.actor._
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.{
|
||||
FileManagerProtocol,
|
||||
@ -39,13 +38,13 @@ class WriteTextualFileHandler(
|
||||
): Receive = {
|
||||
case Status.Failure(ex) =>
|
||||
log.error(s"Failure during $WriteFile operation:", ex)
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.ServiceError)
|
||||
context.stop(self)
|
||||
|
||||
case FileManagerProtocol.WriteFileResult(Left(failure)) =>
|
||||
|
@ -3,7 +3,6 @@ package org.enso.languageserver.requesthandler.refactoring
|
||||
import java.util.UUID
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.refactoring.ProjectNameChangedEvent
|
||||
import org.enso.languageserver.refactoring.RefactoringApi.RenameProject
|
||||
@ -51,7 +50,7 @@ class RenameProjectHandler(timeout: FiniteDuration, runtimeConnector: ActorRef)
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case Api.Response(_, Api.ProjectRenamed(_)) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.search
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.search.SearchApi.{
|
||||
@ -60,7 +59,7 @@ class CompletionHandler(
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case msg: SearchProtocol.SearchFailure =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.search
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.search.SearchApi.{
|
||||
@ -50,7 +49,7 @@ class GetSuggestionsDatabaseHandler(
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case msg: SearchProtocol.SearchFailure =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.search
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.search.SearchApi.{
|
||||
@ -50,7 +49,7 @@ class GetSuggestionsDatabaseVersionHandler(
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case msg: SearchProtocol.SearchFailure =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.search
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.search.SearchApi.{
|
||||
@ -50,7 +49,7 @@ class ImportHandler(
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case msg: SearchProtocol.SearchFailure =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.search
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props, Status}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.{
|
||||
@ -54,7 +53,7 @@ class InvalidateSuggestionsDatabaseHandler(
|
||||
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case msg: SearchProtocol.SearchFailure =>
|
||||
|
@ -1,8 +1,7 @@
|
||||
package org.enso.languageserver.requesthandler.session
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult}
|
||||
import org.enso.jsonrpc.{Errors, Id, Request, ResponseError, ResponseResult}
|
||||
import org.enso.languageserver.filemanager.FileManagerProtocol
|
||||
import org.enso.languageserver.filemanager.FileManagerProtocol.ContentRootsResult
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
@ -42,7 +41,7 @@ class InitProtocolConnectionHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Getting content roots timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ContentRootsResult(contentRoots) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.text
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.session.JsonSession
|
||||
@ -45,7 +44,7 @@ class ApplyEditHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Applying edit for ${rpcSession.clientId} timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ApplyEditSuccess =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.text
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.session.JsonSession
|
||||
@ -45,7 +44,7 @@ class CloseFileHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Closing file for ${rpcSession.clientId} timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileClosed =>
|
||||
|
@ -1,8 +1,7 @@
|
||||
package org.enso.languageserver.requesthandler.text
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc.{Id, Request, ResponseError, ResponseResult}
|
||||
import org.enso.jsonrpc.{Errors, Id, Request, ResponseError, ResponseResult}
|
||||
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.session.JsonSession
|
||||
@ -49,7 +48,7 @@ class OpenFileHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Opening file for ${rpcSession.clientId} timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case OpenFileResponse(Right(OpenFileResult(buffer, capability))) =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.text
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.filemanager.FileSystemFailureMapper
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
@ -55,7 +54,7 @@ class SaveFileHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Saving file for ${rpcSession.clientId} timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case FileSaved =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.visualisation
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.data.ClientId
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
@ -52,7 +51,7 @@ class AttachVisualisationHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ContextRegistryProtocol.VisualisationAttached =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.visualisation
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.data.ClientId
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
@ -52,7 +51,7 @@ class DetachVisualisationHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ContextRegistryProtocol.VisualisationDetached =>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.enso.languageserver.requesthandler.visualisation
|
||||
|
||||
import akka.actor.{Actor, ActorLogging, ActorRef, Cancellable, Props}
|
||||
import org.enso.jsonrpc.Errors.ServiceError
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.data.ClientId
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
@ -51,7 +50,7 @@ class ModifyVisualisationHandler(
|
||||
): Receive = {
|
||||
case RequestTimeout =>
|
||||
log.error(s"Request $id timed out")
|
||||
replyTo ! ResponseError(Some(id), ServiceError)
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ContextRegistryProtocol.VisualisationModified =>
|
||||
|
@ -109,6 +109,7 @@ object Errors {
|
||||
case object ServiceError extends Error(1, "Service error")
|
||||
case object NotImplementedError
|
||||
extends Error(10, "The requested method is not implemented")
|
||||
case object RequestTimeout extends Error(11, "Request timeout")
|
||||
case class UnknownError(
|
||||
override val code: Int,
|
||||
override val message: String,
|
||||
|
Loading…
Reference in New Issue
Block a user