theres absolutely no guide as to how to send an er...
# help
m
theres absolutely no guide as to how to send an error message back
m
thanks for following up, I actually searched all over for answers and I tried a bunch of these articles but nothing seems to actually propagate the error message thru the mapping
That 2nd link i dont even know ow do you put that template into the appsync stack class ?
just use the fromString helper?
f
Following the AWS example above, it seems to work for me. Here’s my schema:
Copy code
type Query {
  foo: String
}
Here’s the Lambda resolver:
Copy code
exports.handler = (event, context, callback) => {
    callback("I fail.");
};
Here’s the query response:
Copy code
{
  "data": {
    "foo": null
  },
  "errors": [
    {
      "path": [
        "foo"
      ],
      "data": null,
      "errorType": "string",
      "errorInfo": null,
      "locations": [
        {
          "line": 2,
          "column": 3,
          "sourceName": null
        }
      ],
      "message": "I fail"
    }
  ]
}
m
really appreciate the help @Frank
But my handler signature is
Copy code
export async function handler(
  event: ClanEvent
): Promise<
  | Record<string, unknown>[]
  | boolean
  | Clan[]
  | ActionResponse
  | SamuraiResult
  | undefined
  | string
  | Samurai
  | null
> {
so in there is a switch case that returns the different resolvers based on event arguments...I wanna just be able to throw an error from any of those resolvers and have it arrive to the client
Apollo lets u do this
f
Hey @Marko Bilal, gotcha.. yeah, I haven’t used AppSync enough to know the right solution. sorry for the late follow up.