Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to Handle all exceptions in single javascript policy.

Hi,
Iam doing exception handling in APIGEE, I implemented below JS to handle few errors. Also I want to remove the prefix for "ErrorDescription" field from the dynamic error responses.

Please let me know, if anyone have any standard or suggested approach to handle all exceptions in single JS policy.
Thanks in Advance.

RakeshSudhagoni_0-1731653630923.pngRakeshSudhagoni_1-1731653650175.png

 

Solved Solved
0 4 235
2 ACCEPTED SOLUTIONS

@RakeshSudhagoni - I've added more to the sample now. Please take a look. Also I dont think its a good idea to reveal the Regex to the end user. A hacker could try something else outside of this Regex if needed. Apigee returns this for info which needs to be converted into a custom message while sending to the client. 

View solution in original post

4 REPLIES 4

Hello @RakeshSudhagoni, we truly appreciate your post and your patience as we keep track of your question. We’ll make sure you get the answers you need, and we also invite the community to pitch in with their thoughts

@RakeshSudhagoni - Take a look at this sample

Hi @ssvaidyanathan , Above bundle seems, it handles few exceptions only and I am working  for all for customized error responses. Also, trying to remove prefix from error.message...

Example:

Regular Expression Threat Detected in REGXTP: regex: [\\s]*(?i)((delete)|(exec)|(drop\\s*table)|(insert)|(shutdown)|(update)|(\\bor\\b)) input: {\"name\":\"insert\"}
 
Here, I want to reply to the client with bolded part of data only remain will remove dynamically. Can you suggest for this....

@RakeshSudhagoni - I've added more to the sample now. Please take a look. Also I dont think its a good idea to reveal the Regex to the end user. A hacker could try something else outside of this Regex if needed. Apigee returns this for info which needs to be converted into a custom message while sending to the client.