How to listen to 'attachment filesize limit reached' event

I need to run a script whenever the above error shows in Confluence.
The event listener i believe would listen to the ‘attachmentcreatedevent’ which is when the attachment is successfully uploaded.
I this case, the attachment would never get uploaded since its filesize is bigger than the limit we have set up.
The external script i need to run is to initiate upload of that file to our internal sharepoint server after checking user credentials and whatnot.
Any ideas?