Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
How to return custom error from API Gateway

I have a Lambda application integrated with API Gateway, and I want to return this response body in the case of 409 error (conflict exception)

{
  "message": "some error message",
  "someObject": {
    "propert1": "val1"
  }
}

But according to this documentation https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Response.html#error-property, the error object doesn't expose deserialized data from service, except for message. Hence, in my JavaScript application, I only have an access to message property: "some error message", but I need to access someObject. How can I solve this? Do I need to serialize the object and bind it to message property?

I am using REST API and in Lambda we use javax.ws.rs.core.Response to return a response

data class Error(val message: String, val someObject: SomeDataClass)
...
val error = Error('message', someObject)
return Response.status(code).entity(error).build()
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!