Instanceof regression when updating to Zurich
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello team!
We're encountering a strange error while deploying our app using now-sdk cli since Zurich (the issue wasn't present on Xanadu).
The issue is related to the usage of "instanceof" (and possibly realted to file paths aswell) when throwing a custom Error and catching it in another file.
This WILL NOT trigger the error :
- /src/server/Service.ts => throw a new FunctionalException (which extends the standard Error class)
- /src/server/Controller => catch this exception, print the instanceof the error: "instanceof FunctionalException = true"
This WILL trigger the error :
- /src/server/services/Service.ts => throw a new FunctionalException (which extends the standard Error class) : notice that this script is located on level below Controller.ts from the project root
- /src/server/Controller.ts => catch this exception, print the instanceof the error: "instanceof FunctionalException = false"
To illustrate the issue, i created a now-sdk 4 demo project that you'll find as attachment.
This demo project expose a Scripted Rest API (using Fluent). One http endpoint will throw and catch an error correctly (GET <hostname>/api/x_frt_errordemo/v1/trigger_boum_demo/api/boum/ok), the other one will trigger the issue (GET <hostname>/api/x_frt_errordemo/v1/trigger_boum_demo/api/boum/ko).
-> DemoController will catch any exception and print the instanceof of the catched error
-> Service.ts will throw a FunctionalException (Service.ts is located on the same level as DemoController.ts)
-> SubService.ts will throw the same FunctionalException (SubService.ts is located one level deeper than DemoController).
If you need more details, do not hesitate!
Thanks for your time!
Best regards,
Anthony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @anthonydian
I would say that since this issue is coming from an upgrade, it’s better to log a support case with ServiceNow.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6m ago
Hi @Dr Atul G- LNG and thanks for your time!
A support case has already been created, but I also wanted to know if the community ever faced a similar issue :)!
