Gui 1340 Convert javascript error handling to use common code in service.

https://eucalyptus.atlassian.net/browse/GUI-1340