Fixed error reporting to so errors actually show up

Ok, this change includes a couple other quality-of-life improvements that I stumbled on while coding it up. Namely, the change to server_test.go to use TempDir() is necessary because the hardcoded temp file it was previously using was causing a test to fail due to lingering test files from old test runs that were in the old format. (also, it would most likely fail on a non-unix system). New version uses a system-safe method and now cleans up after itself. 
The change to server.go itself is because previously, the error was being upload as a Golang error object, which javascript doesn't know what to do with. I've created a generic method that takes a struct and converts it to a string/interface map, which should hopefully be generic enough to take anything you throw at it and convert it to something javascript can read. 

Bunch of gofmt changes to the files I touched.