Add support for error codes

These error codes are not provided in the default errors. 

They can be added by custom error defined by users.