Skip to content

Instantly share code, notes, and snippets.

View maniish-jaiin's full-sized avatar
🎯
Focusing

Manish Jain maniish-jaiin

🎯
Focusing
View GitHub Profile
public class GraphQLException extends RuntimeException implements GraphQLError {
String customMessage;
public GraphQLException(String customMessage) {
this.customMessage = customMessage;
}
@Override
@Service
class CarService {
fun getCar(input: String): Car {
return CarMap.cars[input]
?: throw CarNotFoundException("Car with name = $input not found",
mapOf("name" to input))
}
fun createCar(input: CarInput): Car {
val car = Car(input.name, input.price, input.engineType)
{
"errors": [
{
"message":
"Exception while fetching data (/getCar) : Car with name = B Class not found",
"path": [
"getCar"
],
"extensions": {
type Mutation {
addComment(input: AddCommentInput!): Comment
}
input AddCommentInput {
userId: ID
body: String
}
type Comment {
type Comment {
body: String
userId: ID
}
type Comment {
body: String
user: User
}
type User{
id: ID
name: String
}
query getComments {
comment {
body
user{
id
name
}
}
}
{
"errors": [
{
"message": "Internal Server Error(s) while executing query"
}
],
"data": null
}
interface Profile {
id: ID
name: String
}
type User implements Profile {
id: ID
name: String
age: Int
}
union SearchResult = User | Company
type User {
name: String
age: Int
}
type Company {
name: String
address: Int