server: return proper error on failure

Also adds comments for more information about input message.

Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>