Improving exception system

1. adding codes to all exceptions
2. adding more exception classes

Fixes #17