mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-03 16:05:24 -04:00
Three points raised on #5038 after it was merged. ajaxError() documents the reason field as included "only when set", but tested it for truthiness, which would also drop '' and '0'. None of the four STREAM_ERR_ constants are falsy so nothing changed behaviour, but the check now matches the documented contract. The client already treats an empty reason as fatal, so a caller that does pass one still gets the old handling. The case 0 branch called ajaxError() twice in sequence and relied on the first one exiting to keep the second from running on a timeout. Made the two paths mutually exclusive so it no longer depends on that. The test's "every ajaxError call is classified" assertion compared the number of call sites to the number of STREAM_ERR_ occurrences anywhere in the file. The four define()s are part of that count, so up to four calls could lose their classification and the test would still pass - verified by dropping the argument from one call, which the old assertion accepted. It now matches each call to the end of its statement and requires every one to carry a constant.