Gmod Exits Automatically!

When I join a server, My screen turns blank and a window pops up saying The game encountered an error, but does not give me any information.

Also,When sometimes go on a server, It takes a very long time to get on and the screen freezes and I then it unfreezes and stays like that for awhile, then goes back to server select.

Can anyone help me?