iachat/spec/lib
Aakash Bakhle 67dc21ea5f
fix: Hardcoded 500 in AI api error response(#13005)
## Description

Please include a summary of the change and issue(s) fixed. Also, mention
relevant motivation, context, and any dependencies that this change
requires.

Fixes false new relic alerts set due to hardcoding an error code

## Type of change


Bug fix (non-breaking change which fixes an issue)
## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration.

Before
<img width="776" height="666" alt="image"
src="https://github.com/user-attachments/assets/f086890d-eaf1-4e83-b383-fe3675b24159"
/>

the 500 was hardcoded. 
RubyLLM doesn't send any error codes, so i removed the error code
argument and just pass the error message

Langfuse gets just the error message

<img width="883" height="700" alt="image"
src="https://github.com/user-attachments/assets/fc8c3907-b9a5-4c87-bfc6-8e05cfe9c8b0"
/>

local logs only show error
<img width="1434" height="200" alt="image"
src="https://github.com/user-attachments/assets/716c6371-78f0-47b8-88a4-03e4196c0e9a"
/>

Better fix is to handle each case and show the user wherever necessary

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream
modules

---------

Co-authored-by: aakashb95 <aakash@chatwoot.com>
2025-12-04 20:32:46 +05:30
..
email_templates chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
integrations fix: Hardcoded 500 in AI api error response(#13005) 2025-12-04 20:32:46 +05:30
redis chore: Unset Redis config after spec (#8685) 2024-01-10 15:32:48 -08:00
webhooks feat: Customizable webhook timeout configuration (#12777) 2025-11-17 14:43:23 -08:00
base_markdown_renderer_spec.rb feat: support image height in markdown rendering of messages (#8177) 2023-11-02 13:51:54 -07:00
chatwoot_captcha_spec.rb chore: Update dependencies to the latest versions (#5033) 2022-07-15 09:51:59 +07:00
chatwoot_exception_tracker_spec.rb chore: Load only required APMs (#6497) 2023-03-01 14:31:51 +05:30
chatwoot_hub_spec.rb feat: Provision captain accounts automatically (#10168) 2024-09-26 19:21:29 -07:00
chatwoot_markdown_renderer_spec.rb feat: Adds backend support for rendering tables in articles (#9526) 2024-05-24 08:44:01 +05:30
config_loader_spec.rb Feature: Installation global config (#839) (#840) 2020-05-10 22:40:36 +05:30
custom_markdown_renderer_spec.rb fix: Update Arcade embed aspect ratio (#12923) 2025-11-24 20:22:27 +05:30
dyte_spec.rb feat: Upgrade Dyte apis to v2 (#10706) 2025-02-19 14:47:48 -08:00
global_config_service_spec.rb chore: Update dependencies to the latest versions (#5033) 2022-07-15 09:51:59 +07:00
global_config_spec.rb Feature: Global Config helper (#844) (#845) 2020-05-11 19:00:33 +05:30
linear_spec.rb feat: Add user attribution to Linear integration with actor authorization (#11774) 2025-07-01 16:49:26 +05:30
online_status_tracker_spec.rb fix: Get online status from db when not present in cache [CW-3233] (#9477) 2024-05-15 21:23:19 -07:00
vapid_service_spec.rb feat: migrate facebook env vars to globalConfig (#3369) 2021-11-25 00:55:26 +05:30