Display an alert when a Statistic on StatServer doesn't exist

Hi,
I am building an app which writes in a file statistics.
I would like to know if there is a way to display to the user if a statistic he requested doesn’t exist (for example he chose a stat type which is not correspond to an Agent)
Because when the statistic doesn’t exist, the handler “StatServer_Received_Handler” is not called, and nothing happen.


...
   Endpoint statServerEndpoint = new Endpoint(statServerHost, statServerPort);
   statServer = new StatServerProtocol(statServerEndpoint);
   statServer.Received += StatServer_Received_Handler;
...


 private static void StatServer_Received_Handler(object sender, EventArgs e)
        {
          // write the stat in a file
         }


I really appreciate our help.
Thank you.

Because it is not an error, it is a miss configuration.
Therefore, no alerts or whatsoever. StatServer just tries to execute but nothing happens.