added standard errror codes to mercury

Added standard error codes to mercury gateways

@jpcaissy @j-mutter please review

@louiskearns 
Same thing about the ternary operator.