Fail fast if negative limit is passed to GetMessages, fast track if limit is zero
Created by: uwx
Summary
Corrects a misleading exception when GetMessages is called with limit < 0, and fast-tracks when limit is 0.
Details
Previously, passing limit < 0 would bubble up an ArgumentOutOfRangeException
from the List constructor; this makes it throw an ArgumentException. I also made it so it instantly returns an empty array when limit is 0.
Changes proposed
- If limit is < 0, throw an ArgumentException
- If limit is 0, return an empty array