-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
263 additions
and
106 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
lib/src/main/java/graphql/nadel/NadelUncaughtExecutionError.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package graphql.nadel | ||
|
||
import graphql.nadel.error.NadelGraphQLError | ||
|
||
internal class NadelUncaughtExecutionError( | ||
message: String, | ||
extensions: Map<String, Any?>, | ||
val cause: Throwable, | ||
) : NadelGraphQLError( | ||
message = message, | ||
extensions = extensions, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
lib/src/main/java/graphql/nadel/error/NadelGraphQLError.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package graphql.nadel.error | ||
|
||
import graphql.ErrorClassification | ||
import graphql.GraphQLError | ||
import graphql.language.SourceLocation | ||
|
||
internal abstract class NadelGraphQLError( | ||
private val message: String, | ||
private val extensions: Map<String, Any?>, | ||
private val path: List<Any>? = null, | ||
private val errorClassification: ErrorClassification? = null, | ||
) : GraphQLError { | ||
override fun getMessage(): String { | ||
return message | ||
} | ||
|
||
override fun getLocations(): MutableList<SourceLocation>? { | ||
return null | ||
} | ||
|
||
override fun getPath(): List<Any>? { | ||
return path | ||
} | ||
|
||
override fun getErrorType(): ErrorClassification { | ||
return errorClassification ?: ErrorClassification.errorClassification(javaClass.simpleName) | ||
} | ||
|
||
override fun getExtensions(): Map<String, Any?> { | ||
return extensions | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...graphql/nadel/instrumentation/parameters/NadelInstrumentationOnGraphQLErrorsParameters.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package graphql.nadel.instrumentation.parameters | ||
|
||
import graphql.GraphQLError | ||
import graphql.execution.instrumentation.InstrumentationState | ||
|
||
data class NadelInstrumentationOnGraphQLErrorsParameters( | ||
val errors: List<GraphQLError>, | ||
val serviceName: String, | ||
private val instrumentationState: InstrumentationState?, | ||
) { | ||
fun <T : InstrumentationState?> getInstrumentationState(): T? { | ||
@Suppress("UNCHECKED_CAST") // trust the caller | ||
return instrumentationState as T? | ||
} | ||
} |
Oops, something went wrong.