The moral code that is clearly the message of this witty yet thoughtful novel points to the dangers of trusting in our instincts and imagination rather than in the facts of the situation. What makes this novel so hilarious is the many mishaps suffered by both the eponymous heroine, Emma Woodhouse, but also by various other people, such as Mr. Knightley. Both of these central characters form a number of opinions that are based on nothing more than hearsay or their own idea, which prevent them from looking at the situation with objective, dispassionate judgement.
For example, Emma clearly misinterprets Mr. Elton's actions, even though Austen makes it very clear to the reader that he is not in love with Harriet, because the force of her imagination has decreed that he is love with Harriet and not her. Note what she later confesses:
She had taken up the idea, she supposed, and made everything bend to it.
In the same way, Mr. Knightley is unable to consider Frank Churchill in an objective way because of the attachment he sees forming between Frank and Emma. His jealousy forces him to disapprove of a man whom he has no solid basis to disapprove of. Consider the following quote, which acts as the moral message of the play, which comes after Mr. Knightley and Emma's betrothal in Chapter 50:
Seldom, very seldom does complete truth belong to any human disclosure; seldom can it happen that something is not a little disguised, or a little mistaken; but where, as in this case, though the conduct is mistaken, the feelings are not, it may not be very material.
This quote is important because it points towards the impossibility of gaining complete truth in any situation, because of our own personal biases and emotions. Austen's moral code is therefore that all humans need to be very chary of claiming to have "complete truth" and acting on it, because so often humans can be mistaken about that "truth." The only remedy is to trust in the wholehearted and honest emotion that springs from the human heart.