Revert "Remove restrictions on JSON-RPC error codes"

This reverts commit f5843ce4daa393230104972feb2ccdabf30df6dd.