Dedicated error reporting function

TODO: Client side error reporting. Also handle errors in SGUI better.