If using URLConnection to download file and I get bad request (400) then content of the bad request thus the error message still creates file but puts the error in the file.
I can prevent this by getting the HeadersReceived event and check for status 400, and then do Disconnect.
However empty file is still created, and I have no way to get the error message.
And note the Error event will never get fired.
Is there anything I am missing here or should I just take the result as string and ignore the buggy design of the file downloading ?