Only match ERROR at start of response line, not within content
When parsing responses from the memcached server, we incorrectly interpreted any response containing "ERROR" as an error response. However, according to the memcached protocol specification, error responses must START with specific tokens:
Each command sent by a client may be answered with an error string from the server. These error strings come in three types:
- "ERROR\r\n"
- "CLIENT_ERROR
\r\n" - "SERVER_ERROR
\r\n"
This PR fixes the bug by checking if the response starts with an error token rather than just containing it. Added test cases verify correct handling of:
- Responses starting with "ERROR"
- Responses containing but not starting with "ERROR"
- CLIENT_ERROR responses
- SERVER_ERROR responses
Fixes potential issues where valid responses containing "ERROR" in the content would be incorrectly treated as errors.
@vavrusa I wanted to check if there's anything I can do to help move this PR forward. I'm happy to make any requested changes or provide additional context if needed. Thanks for your time!
LGTM, thanks!