Answer the question
In order to leave comments, you need to log in
How to handle an exception in golang?
Good afternoon, how to handle an exception in go?
There is a code Message.Send(ActiveClients[input].websocket, string(ans.Message))
And if instead of input we substitute either a string value or a non-existent numeric value, then the program crashes. How to process it?
Thanks
Answer the question
In order to leave comments, you need to log in
var a =ActiveClients[input].websocket
if a!=nil {Message.Send(ActiveClients[input].websocket, string(ans.Message))}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question