Replaced exceptions by errorcodes for easier debugging and error handling

See errorcodes.txt for a code -> message translation
Replaced tabs with spaces